kubernetes/kops · error

KubernetesVersion not set

Error message

KubernetesVersion not set

What it means

Run() requires cluster.Spec.KubernetesVersion to be non-empty after DeepValidate succeeds. The kubernetesVersion field drives every asset URL (kubelet, control-plane binaries, manifests); without it the loader cannot build the cluster, so Run fails fast.

Source

Thrown at upup/pkg/fi/cloudup/apply_cluster.go:309

				fmt.Printf("\n")
				fmt.Printf("%s\n", starline)
				fmt.Printf("\n")
				return nil, fmt.Errorf("kops version older than last used to update the cluster")
			}
		} else if err != os.ErrNotExist {
			return nil, fmt.Errorf("error reading last kops version used to update: %v", err)
		}
	}

	cloud := c.Cloud

	err = validation.DeepValidate(c.Cluster, c.InstanceGroups, true, c.Clientset.VFSContext(), cloud)
	if err != nil {
		return nil, err
	}

	if cluster.Spec.KubernetesVersion == "" {
		return nil, fmt.Errorf("KubernetesVersion not set")
	}
	if cluster.Spec.DNSZone == "" && cluster.PublishesDNSRecords() {
		return nil, fmt.Errorf("DNSZone not set")
	}

	l := &Loader{}
	l.Init()

	keyStore, err := c.Clientset.KeyStore(cluster)
	if err != nil {
		return nil, err
	}

	sshCredentialStore, err := c.Clientset.SSHCredentialStore(cluster)
	if err != nil {
		return nil, err
	}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Set the version: `kops edit cluster` and add/fix `spec.kubernetesVersion: v1.29.2` (or the desired supported version), then rerun.
  2. If the spec was generated programmatically, set spec.KubernetesVersion before invoking ApplyCluster (use kopscluster defaults or the recommended release).
  3. Check the YAML actually parses the field (verify with `kops get cluster <name> -o yaml`).

Example fix

// before (cluster spec yaml)
spec:
  channel: stable
// after
spec:
  channel: stable
  kubernetesVersion: 1.29.2
Defensive patterns

Strategy: validation

Validate before calling

if cluster.Spec.KubernetesVersion == "" {
    return fmt.Errorf("spec.kubernetesVersion must be set before applying")
}

Prevention

When it happens

Trigger: Applying/updating a cluster whose spec has an empty spec.kubernetesVersion — typically a cluster spec created programmatically or hand-edited and missing the field, or YAML that silently dropped the key.

Common situations: Generating Cluster manifests with a tool/template that omits kubernetesVersion; YAML indentation error causing the key to be ignored; kOps Go code constructing api.Cluster{} without setting KubernetesVersion before calling ApplyCluster.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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