{"record":{"id":"87c36e62a3fa4847","repo":"kubernetes/kops","slug":"no-networking-mode-set-87c36e","errorCode":null,"errorMessage":"no networking mode set","messagePattern":"no networking mode set","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/model/components/kubecontrollermanager.go","lineNumber":134,"sourceCode":"\t\t\t// kcm should not allocate node cidrs with the CloudAllocator if we're using the external CCM\n\t\t\tkcm.AllocateNodeCIDRs = new(false)\n\t\t} else {\n\t\t\tkcm.CIDRAllocatorType = new(\"CloudAllocator\")\n\t\t}\n\t} else if networking.Kindnet != nil {\n\t\t// We don't expect KCM to configure routes; it should be done by the CCM (or by the infrastructure)\n\t\tkcm.ConfigureCloudRoutes = new(false)\n\n\t\t// If the cloud is allocating the node CIDRs, that should be done by CCM\n\t\tif o.GetCloudProvider() == kops.CloudProviderGCE && gce.UsesIPAliases(o) {\n\t\t\tkcm.AllocateNodeCIDRs = new(false)\n\t\t}\n\t} else if networking.External != nil {\n\t\tkcm.ConfigureCloudRoutes = new(false)\n\t} else if UsesCNI(networking) {\n\t\tkcm.ConfigureCloudRoutes = new(false)\n\t} else {\n\t\treturn fmt.Errorf(\"no networking mode set\")\n\t}\n\n\tif kcm.UseServiceAccountCredentials == nil {\n\t\tkcm.UseServiceAccountCredentials = new(true)\n\t}\n\n\tif len(kcm.Controllers) == 0 {\n\t\tvar changes []string\n\t\tif clusterSpec.IsKopsControllerIPAM() {\n\t\t\tchanges = append(changes, \"-nodeipam\")\n\t\t}\n\t\tif len(changes) != 0 {\n\t\t\tkcm.Controllers = append([]string{\"*\"}, changes...)\n\t\t}\n\t}\n\n\treturn nil\n}","sourceCodeStart":116,"sourceCodeEnd":152,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/model/components/kubecontrollermanager.go#L116-L152","documentation":"BuildOptions inspects cluster.spec.networking to decide whether kube-controller-manager should configure cloud routes. If none of the known networking modes (kubenet, external, CNI-based, etc.) is set, it cannot determine route behavior and returns this error. It guards against a cluster spec with an empty/unrecognized networking section.","triggerScenarios":"Calling BuildOptions on a cluster whose spec has no networking mode populated — spec.networking is empty or all networking option structs (Kubenet, CNI, External, etc.) are nil, so the final else branch is reached.","commonSituations":"Hand-editing a cluster spec and deleting the networking block; tooling that constructs a Cluster struct programmatically and forgets to set Networking; upgrading/merging YAML that dropped the networking section.","solutions":["Set a networking mode in the cluster spec, e.g. spec.networking.cni: {} for CNI clusters","Use spec.networking.kubenet: {} if relying on cloud routes","Use spec.networking.external: {} for an external (CNI-managed) networking","Re-run kops get/replace with a spec exported from a working cluster to restore the networking section"],"exampleFix":"// before (spec)\nspec:\n  # networking section missing\n// after\nspec:\n  networking:\n    cni: {}","handlingStrategy":"validation","validationCode":"n := cluster.Spec.Networking\nif n == nil || (n.Kubenet == nil && n.External == nil && n.CNI == nil && n.Kope == nil && n.Calico == nil && n.Canal == nil && n.Flannel == nil && n.Weave == nil && n.LyftVPC == nil && n.GCE == nil) {\n    return errors.New(\"cluster spec must set a networking mode before building\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always base new cluster specs on `kops get cluster -o yaml` output which includes networking","Never delete the spec.networking block when editing YAML","Set a minimal networking mode such as cni: {} for standard clusters"],"tags":["networking","kube-controller-manager","cluster-spec","validation"],"backgroundTag":"missing-config-field","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"}