{"record":{"id":"18f899bc04452ca4","repo":"kubernetes/kops","slug":"validation-of-the-full-cluster-and-instance-group","errorCode":null,"errorMessage":"validation of the full cluster and instance group specs failed: %w","messagePattern":"validation of the full cluster and instance group specs failed: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/kops/create_cluster.go","lineNumber":775,"sourceCode":"\t\t\treturn fmt.Errorf(\"error loading cluster addon %s: %v\", p, err)\n\t\t}\n\t\taddons = append(addons, addon.Objects...)\n\t}\n\n\t{\n\t\t// Build full IG spec to ensure we end up with a valid IG\n\t\tfullInstanceGroups := []*api.InstanceGroup{}\n\t\tfor _, group := range instanceGroups {\n\t\t\tfullGroup, err := cloudup.PopulateInstanceGroupSpec(cluster, group, cloud, clusterResult.Channel)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tfullInstanceGroups = append(fullInstanceGroups, fullGroup)\n\t\t}\n\n\t\terr = validation.DeepValidate(fullCluster, fullInstanceGroups, true, clientset.VFSContext(), nil)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"validation of the full cluster and instance group specs failed: %w\", err)\n\t\t}\n\t}\n\n\tif c.DryRun {\n\t\tvar obj []runtime.Object\n\t\tobj = append(obj, cluster)\n\n\t\tfor _, group := range instanceGroups {\n\t\t\t// Cluster name is not populated, and we need it\n\t\t\tgroup.ObjectMeta.Labels = make(map[string]string)\n\t\t\tgroup.ObjectMeta.Labels[api.LabelClusterName] = cluster.ObjectMeta.Name\n\t\t\tobj = append(obj, group)\n\t\t}\n\n\t\tfor name, key := range c.SSHPublicKeys {\n\t\t\tobj = append(obj, &api.SSHCredential{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tName: name,","sourceCodeStart":757,"sourceCodeEnd":793,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/cmd/kops/create_cluster.go#L757-L793","documentation":"After expanding instance groups into full specs, RunCreateCluster calls validation.DeepValidate on the fully built cluster and instance groups. This error means the combined spec is invalid (bad subnet mapping, invalid machine type, missing required fields, cross-object conflicts). It fires only when the full-spec build succeeded but deep validation rejected it, and it wraps the detailed validation message.","triggerScenarios":"`kops create cluster` with flags/specs that pass basic parsing but fail DeepValidate: invalid --networking choice, instance group referencing a nonexistent zone/subnet, invalid Kubernetes version, cluster name not matching cloud DNS requirements.","commonSituations":"Using an instance group zone outside the cluster's region; typos in cloud-specific flags (bad GCE machine type); mixing networking options unsupported by the topology; cluster name without a valid DNS suffix for the cloud.","solutions":["Read the wrapped %w message for the specific field that failed validation.","Fix the offending flag, zone/subnet, or cluster name and re-run.","Use `kops create -f cluster.yaml --dry-run` to validate a manifest interactively.","Check docs for the cloud provider's supported values (zones, machine types, networking modes)."],"exampleFix":"// before\nkops create cluster --zones us-east-1a --node-size t3.micro k8s.local\n// after\nkops create cluster --zones us-east-1a --node-size t3.micro example-cluster.k8s.local","handlingStrategy":"validation","validationCode":"// sanity-check before running create\nfor _, ig := range instanceGroups {\n\tif ig.Spec.MachineType == \"\" || len(ig.Spec.Subnets) == 0 {\n\t\treturn fmt.Errorf(\"instance group %s missing machineType or subnets\", ig.ObjectMeta.Name)\n\t}\n}\nif !strings.Contains(clusterName, \".\") && cloudProvider != \"\" {\n\t// gossip-only names (no dots) are invalid for many cloud providers\n}\n","typeGuard":null,"tryCatchPattern":"if err := runCreateCluster(...); err != nil {\n\tvar verr *validation.ValidationError\n\tif strings.Contains(err.Error(), \"validation of the full cluster\") {\n\t\t// err wraps the detailed field errors; log and fix the flagged fields\n\t}\n\treturn err\n}","preventionTips":["Use `--dry-run` first to validate the spec before persisting.","Keep cluster name, zones, and subnets consistent with the target region.","Pin a known-good Kubernetes version with --kubernetes-version.","Copy flag combinations from working examples rather than mixing docs."],"tags":["cli","validation","cluster-spec"],"backgroundTag":"cluster-validation-failed","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"}