{"record":{"id":"6b90b961189676cb","repo":"kubernetes/kops","slug":"kubernetesversion-not-set","errorCode":null,"errorMessage":"KubernetesVersion not set","messagePattern":"KubernetesVersion not set","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/apply_cluster.go","lineNumber":309,"sourceCode":"\t\t\t\tfmt.Printf(\"\\n\")\n\t\t\t\tfmt.Printf(\"%s\\n\", starline)\n\t\t\t\tfmt.Printf(\"\\n\")\n\t\t\t\treturn nil, fmt.Errorf(\"kops version older than last used to update the cluster\")\n\t\t\t}\n\t\t} else if err != os.ErrNotExist {\n\t\t\treturn nil, fmt.Errorf(\"error reading last kops version used to update: %v\", err)\n\t\t}\n\t}\n\n\tcloud := c.Cloud\n\n\terr = validation.DeepValidate(c.Cluster, c.InstanceGroups, true, c.Clientset.VFSContext(), cloud)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif cluster.Spec.KubernetesVersion == \"\" {\n\t\treturn nil, fmt.Errorf(\"KubernetesVersion not set\")\n\t}\n\tif cluster.Spec.DNSZone == \"\" && cluster.PublishesDNSRecords() {\n\t\treturn nil, fmt.Errorf(\"DNSZone not set\")\n\t}\n\n\tl := &Loader{}\n\tl.Init()\n\n\tkeyStore, err := c.Clientset.KeyStore(cluster)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tsshCredentialStore, err := c.Clientset.SSHCredentialStore(cluster)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n","sourceCodeStart":291,"sourceCodeEnd":327,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/apply_cluster.go#L291-L327","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Set the version: `kops edit cluster` and add/fix `spec.kubernetesVersion: v1.29.2` (or the desired supported version), then rerun.","If the spec was generated programmatically, set spec.KubernetesVersion before invoking ApplyCluster (use kopscluster defaults or the recommended release).","Check the YAML actually parses the field (verify with `kops get cluster <name> -o yaml`)."],"exampleFix":"// before (cluster spec yaml)\nspec:\n  channel: stable\n// after\nspec:\n  channel: stable\n  kubernetesVersion: 1.29.2","handlingStrategy":"validation","validationCode":"if cluster.Spec.KubernetesVersion == \"\" {\n    return fmt.Errorf(\"spec.kubernetesVersion must be set before applying\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Create clusters only via `kops create cluster`, which fills defaults.","Validate generated cluster specs with `kops toolbox template` or dry-run before applying.","Lint YAML templates for indentation so nested keys are not silently dropped."],"tags":["validation","cluster-spec","kubernetes-version"],"backgroundTag":"missing-required-argument","analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T07:17:12.445Z"}