{"record":{"id":"058c16e10c10a733","repo":"kubernetes/kops","slug":"could-not-find-any-non-overlapping-cidrs-in-parent","errorCode":null,"errorMessage":"could not find any non-overlapping CIDRs in parent NetworkCIDR; cannot automatically assign CIDR to subnet","messagePattern":"could not find any non-overlapping CIDRs in parent NetworkCIDR; cannot automatically assign CIDR to subnet","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/subnets.go","lineNumber":209,"sourceCode":"\t// Remove any CIDRs marked as overlapping\n\t{\n\t\tvar nonOverlapping []*net.IPNet\n\t\tfor _, c := range bigCIDRs {\n\t\t\toverlapped := false\n\t\t\tfor _, r := range reserved {\n\t\t\t\tif subnet.Overlap(r, c) {\n\t\t\t\t\toverlapped = true\n\t\t\t\t}\n\t\t\t}\n\t\t\tif !overlapped {\n\t\t\t\tnonOverlapping = append(nonOverlapping, c)\n\t\t\t}\n\t\t}\n\t\tbigCIDRs = nonOverlapping\n\t}\n\n\tif len(bigCIDRs) == 0 {\n\t\treturn fmt.Errorf(\"could not find any non-overlapping CIDRs in parent NetworkCIDR; cannot automatically assign CIDR to subnet\")\n\t}\n\n\t// Assign CIDRs to little subnets\n\tif len(littleSubnets) > 0 {\n\t\tlittleCIDRs, err := subnet.SplitInto8(bigCIDRs[0])\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tbigCIDRs = bigCIDRs[1:]\n\n\t\tfor _, subnet := range littleSubnets {\n\t\t\tif subnet.CIDR != \"\" {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif len(littleCIDRs) == 0 {\n\t\t\t\treturn fmt.Errorf(\"insufficient (little) CIDRs remaining for automatic CIDR allocation to subnet %q\", subnet.Name)\n\t\t\t}","sourceCodeStart":191,"sourceCodeEnd":227,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/subnets.go#L191-L227","documentation":"kOps splits the parent NetworkCIDR into candidate child CIDRs and filters out ones overlapping with explicitly-specified (reserved) subnets. When every candidate overlaps or the parent is too small, automatic CIDR assignment is impossible, so kOps refuses to guess and fails loudly.","triggerScenarios":"Auto-allocation requested (subnets without cidr) while the parent networkCIDR is too small or fully consumed by explicitly reserved subnet CIDRs — e.g. a /24 network with reserved subnets covering all of it.","commonSituations":"Cluster grown over time until explicitly-assigned subnet CIDRs exhaust the networkCIDR; shrinking networkCIDR during an upgrade; many utility/internal subnets each reserving space.","solutions":["Enlarge cluster.spec.networkCIDR (or add a non-overlapping additionalNetworkCIDR) so free space remains","Remove or shrink explicit subnet CIDRs that reserve overlapping space, letting kOps carve them automatically","Move some subnets onto a separate networkCIDR / delete unused subnets before re-running update"],"exampleFix":"// before\nspec:\n  networkCIDR: 10.0.0.0/28  # too small for all subnets\n// after\nspec:\n  networkCIDR: 10.0.0.0/16","handlingStrategy":"validation","validationCode":"_, network, _ := net.ParseCIDR(c.Spec.NetworkCIDR)\nvar reserved []*net.IPNet\nfor _, s := range c.Spec.Networking.Subnets {\n\tif s.CIDR != \"\" {\n\t\tif _, sn, err := net.ParseCIDR(s.CIDR); err == nil { reserved = append(reserved, sn) }\n\t}\n}\n// ensure network has room outside all reserved subnets before auto-assign","typeGuard":"func hasFreeSpace(network *net.IPNet, reserved []*net.IPNet) bool {\n\tfor _, r := range reserved { if subnet.SubnetContains(network, r) && r.String() == network.String() { return false } }\n\treturn true\n}","tryCatchPattern":"if err := PerformAssignments(c, cloud); err != nil {\n\tif strings.Contains(err.Error(), \"non-overlapping CIDRs\") { /* enlarge networkCIDR or drop explicit CIDRs */ }\n\treturn err\n}","preventionTips":["Plan networkCIDR size for current + future subnet count before cluster creation","Avoid specifying explicit CIDRs for every subnet; mix explicit and auto-allocated","Re-check capacity when adding AZs or subnets"],"tags":["network","cidr","capacity","kops"],"backgroundTag":"cidr-space-exhausted","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"}