kubernetes/kops · error

error deleting cluster%q: %v

Error message

error deleting cluster%q: %v

What it means

The final delete of the Cluster object itself failed with a non-NotFound error after keysets and instance groups were cleaned up; the API server rejected or failed the delete call. (The message has a known formatting quirk: a missing space before %q.)

Source

Thrown at pkg/client/simple/api/clientset.go:188

			err = c.KopsClient.InstanceGroups(namespace).Delete(ctx, ig.Name, metav1.DeleteOptions{})
			if err != nil {
				if errors.IsNotFound(err) {
					// Unlikely...
					klog.Warningf("instance group was concurrently deleted")
				} else {
					return fmt.Errorf("error deleting instance group %q: %v", ig.Name, err)
				}
			}
		}
	}

	err = c.KopsClient.Clusters(namespace).Delete(ctx, name, metav1.DeleteOptions{})
	if err != nil {
		if errors.IsNotFound(err) {
			// Unlikely...
			klog.Warningf("cluster %q was concurrently deleted", name)
		} else {
			return fmt.Errorf("error deleting cluster%q: %v", name, err)
		}
	}

	return nil
}

func restNamespaceForClusterName(clusterName string) string {
	// We are not allowed dots, so we map them to dashes
	// This can conflict, but this will simply be a limitation that we pass on to the user
	// i.e. it will not be possible to create a.b.example.com and a-b.example.com
	namespace := strings.ReplaceAll(clusterName, ".", "-")
	return namespace
}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Check the wrapped API error (conflict, RBAC, timeout)
  2. Retry the delete operation
  3. Remove the cluster object manually via kubectl if it persists
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at pkg/client/simple/api/clientset.go:188 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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