kubernetes/kops · error

wait time exceeded during resources deletion

Error message

wait time exceeded during resources deletion

What it means

DeleteResources polls in a loop until all resources are deleted. If a caller passes a positive `wait` duration and the elapsed time exceeds it before every resource reaches Done state, this error is returned. It means deletion is slower than the allowed window — resources may still exist and deletion may still be in progress in the cloud.

Source

Thrown at pkg/resources/ops/delete.go:61

		}

		depMap[k] = append(depMap[k], t.Blocked...)

		if t.Done {
			done[k] = t
		}
	}

	klog.V(2).Info("Dependencies")
	for k, v := range depMap {
		klog.V(2).Infof("\t%s\t%v", k, v)
	}

	timeout := time.Now().Add(wait)
	iterationsWithNoProgress := 0
	for {
		if wait > 0 && time.Now().After(timeout) {
			return fmt.Errorf("wait time exceeded during resources deletion")
		}

		failed := make(map[string]*resources.Resource)

		for {
			phase := make(map[string]*resources.Resource)

			for k, r := range resourceMap {
				if _, d := done[k]; d {
					continue
				}

				if _, d := failed[k]; d {
					// Only attempt each resource once per pass
					continue
				}

				ready := true

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Increase the deletion timeout (e.g. `kops delete cluster --timeout` or larger `wait` duration)
  2. Re-run the delete command — it resumes deleting remaining resources
  3. Investigate resources that repeatedly fail to delete (permissions, dependencies, finalizers in the cloud)
  4. Check cloud provider console for resources stuck in deleting state and clean them up manually

Example fix

// before
err := ops.DeleteResources(cloud, resources, 10, 10*time.Second, 5*time.Minute)
// after — allow more time for large clusters
err := ops.DeleteResources(cloud, resources, 10, 10*time.Second, 30*time.Minute)
Defensive patterns

Strategy: retry

Validate before calling

// Size the timeout from cluster scale before deleting
wait := 30 * time.Minute
if len(resourceMap) > 200 {
    wait = time.Duration(len(resourceMap)) * time.Minute
}

Try / catch

if err := ops.DeleteResources(cloud, resourceMap, 10, 10*time.Second, wait); err != nil {
    if strings.Contains(err.Error(), "wait time exceeded") {
        klog.Warning("deletion timed out; resources may remain — re-running delete resumes")
        return ops.DeleteResources(cloud, resourceMap, 10, 10*time.Second, wait) // idempotent resume
    }
    return err
}

Prevention

When it happens

Trigger: Calling DeleteResources (pkg/resources/ops/delete.go:61) with a finite wait (e.g. `kops delete cluster` default timeout) while cloud resources (LBs, volumes, instances) take longer to reach a deleted state, or some deletes repeatedly fail so the loop never converges before the timeout.

Common situations: Large clusters with many ELBs/EBS volumes that take minutes to drain; cloud provider API rate limiting slowing deletes; a stuck resource (e.g. volume attached, LB with targets) blocking dependency ordering; too-short timeout flag passed by the user.

Related errors


AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05). Data as JSON: /api/errors/a00f5090faf0b0d9. Report an issue: GitHub.