kubernetes/kops · error

upgrade is not for use with imported clusters.)

Error message

upgrade is not for use with imported clusters.)

What it means

Guard in RunUpgradeCluster: the cluster carries the kops.k8s.io/management=imported annotation, meaning it was imported rather than created by kOps. `kops upgrade` only manages kOps-created clusters and refuses to modify imported configuration. (Note the stray ')' in the message.)

Solutions

  1. Manage upgrades of imported clusters with the upstream tooling
  2. Remove the imported annotation only if the cluster is actually kOps-managed
  3. Use kops edit cluster for manual spec changes instead
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at cmd/kops/upgrade_cluster.go:117 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/a72d14dbb4de39c5. Report an issue: GitHub.

Appendix: source

Thrown at cmd/kops/upgrade_cluster.go:117

func RunUpgradeCluster(ctx context.Context, f *util.Factory, out io.Writer, options *UpgradeClusterOptions) error {
	cluster, err := GetCluster(ctx, f, options.ClusterName)
	if err != nil {
		return err
	}

	clientset, err := f.KopsClient()
	if err != nil {
		return err
	}

	instanceGroups, err := commands.ReadAllInstanceGroups(ctx, clientset, cluster)
	if err != nil {
		return err
	}

	if cluster.ObjectMeta.Annotations[kopsapi.AnnotationNameManagement] == kopsapi.AnnotationValueManagementImported {
		return fmt.Errorf("upgrade is not for use with imported clusters.)")
	}

	channelLocation := options.Channel
	if channelLocation == "" {
		channelLocation = cluster.Spec.Channel
	}
	if channelLocation == "" {
		channelLocation = kopsapi.DefaultChannel
	}

	var actions []*upgradeAction
	if channelLocation != cluster.Spec.Channel {
		actions = append(actions, &upgradeAction{
			Item:     "Cluster",
			Property: "Channel",
			Old:      cluster.Spec.Channel,
			New:      channelLocation,
			apply: func() {

View on GitHub (pinned to 4c8573c808)