kubernetes/kops · error

cluster %q already exists; use 'kops update cluster' to appl

Error message

cluster %q already exists; use 'kops update cluster' to apply changes

What it means

RunCreateCluster looks up the named cluster in the state store; if it already exists (and the lookup wasn't a NotFound error), creation is refused with 'cluster %q already exists'. This prevents accidentally overwriting an existing cluster's configuration via create.

Source

Thrown at cmd/kops/create_cluster.go:575

		return err
	}

	if c.ClusterName == "" {
		return fmt.Errorf("--name is required")
	}

	{
		cluster, err := clientset.GetCluster(ctx, c.ClusterName)
		if err != nil {
			if apierrors.IsNotFound(err) {
				cluster = nil
			} else {
				return err
			}
		}

		if cluster != nil {
			return fmt.Errorf("cluster %q already exists; use 'kops update cluster' to apply changes", c.ClusterName)
		}
	}

	if c.OpenstackNetworkID != "" {
		c.NetworkID = c.OpenstackNetworkID
	}

	if featureflag.Azure.Enabled() {
		if c.CloudProvider == "azure" && c.AzureSubscriptionID == "" {
			return fmt.Errorf("--azure-subscription-id is required")
		}
	}

	clusterResult, err := cloudup.NewCluster(&c.NewClusterOptions, clientset)
	if err != nil {
		return err
	}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Use `kops update cluster --name <name> --yes` to apply changes to the existing cluster instead of create
  2. Choose a different cluster name if you truly want a new cluster
  3. Delete the old cluster first with `kops delete cluster --name <name> --yes` if it is no longer needed
  4. Inspect with `kops get clusters` to see what already exists

Example fix

// before
kops create cluster mycluster.example.com ...
// after (cluster exists)
kops update cluster --name mycluster.example.com --yes
Defensive patterns

Strategy: validation

Validate before calling

existing, err := clientset.GetCluster(ctx, name)
if err == nil && existing != nil {
	// use update instead of create
}

Prevention

When it happens

Trigger: Running `kops create cluster` for a cluster name that already has a cluster spec in the state store, or re-running an idempotent creation script a second time.

Common situations: Re-running CI/bootstrap scripts without checking for prior creation; leftover cluster state after a partially deleted cluster; using a generic name that collides with an existing cluster.

Related errors


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