kubernetes/kops · error
waiting for virtual network deletion completion: %w
Error message
waiting for virtual network deletion completion: %w
What it means
Wrapped when the long-running delete operation fails during future.PollUntilDone — BeginDelete succeeded but the vnet deletion later failed or the context ended first. Typically Azure refuses because dependent resources are still attached, or the poll was cancelled/timed out.
Source
Thrown at upup/pkg/fi/cloudup/azure/virtualnetwork.go:81
if err != nil {
var respErr *azcore.ResponseError
if errors.As(err, &respErr) && respErr.ErrorCode == "ResourceGroupNotFound" {
return nil, nil
}
return nil, fmt.Errorf("listing virtual networks: %w", err)
}
l = append(l, resp.Value...)
}
return l, nil
}
func (c *virtualNetworksClientImpl) Delete(ctx context.Context, resourceGroupName, vnetName string) error {
future, err := c.c.BeginDelete(ctx, resourceGroupName, vnetName, nil)
if err != nil {
return fmt.Errorf("deleting virtual network: %w", err)
}
if _, err = future.PollUntilDone(ctx, nil); err != nil {
return fmt.Errorf("waiting for virtual network deletion completion: %w", err)
}
return nil
}
func newVirtualNetworksClientImpl(subscriptionID string, cred *azidentity.DefaultAzureCredential) (*virtualNetworksClientImpl, error) {
c, err := network.NewVirtualNetworksClient(subscriptionID, cred, nil)
if err != nil {
return nil, fmt.Errorf("creating virtual networks client: %w", err)
}
return &virtualNetworksClientImpl{
c: c,
}, nil
}
View on GitHub (pinned to 4c8573c808)
Solutions
- Check Activity Log for the failed delete and delete dependent resources (load balancers, public IPs, peerings, NSGs) first, then retry
- Re-run kops delete cluster — deletion is idempotent and retries are safe
- Extend the context timeout so polling isn't cut off on large deployments
- If truly stuck, remove the vnet manually with az network vnet delete after clearing dependencies
Defensive patterns
Strategy: retry
Validate before calling
// Go: pre-check dependencies that block vnet deletion
peerings, err := vnetPeeringsClient.List(ctx, rg, vnetName)
if err == nil && len(peerings) > 0 {
return fmt.Errorf("delete %d vnet peerings before deleting %s", len(peerings), vnetName)
} Try / catch
err := vnetsClient.Delete(ctx, rg, vnetName)
if err != nil {
if ctx.Err() != nil {
return fmt.Errorf("vnet deletion interrupted; re-run kops delete cluster to resume")
}
return fmt.Errorf("vnet delete failed (check Activity Log for dependent resources): %w", err)
} Prevention
- Remove load balancers, public IPs, peerings, and NICs before deleting a vnet
- Allow generous timeouts for teardown of large clusters
- Re-run kops delete cluster; deletion is resumable/idempotent
- If stuck, clear dependencies manually then az network vnet delete
When it happens
Trigger: Delete's future.PollUntilDone(ctx, nil) returns an error: the ARM delete operation reached Failed state (dependent resources like load balancers, public IPs, or NICs still referencing the vnet/subnet), or ctx cancellation/timeout during polling.
Common situations: kops delete cluster tearing down while peering connections, load balancers or application security groups still reference subnets; user cancels the delete mid-way; ARM slow deletes exceeding local timeouts.
Related errors
- deleting virtual network: %w
- creating/updating virtual network: %w
- waiting for virtual network create/update completion: %w
- listing virtual networks: %w
- waiting for public ip address deletion completion: %w
AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05).
Data as JSON: /api/errors/d959e8c7d7954461.
Report an issue: GitHub.