kubernetes/kops · error

linode subnet requires a CIDR

Error message

linode subnet %q requires a CIDR

What it means

Linode NetworkModelBuilder.Build() validates that every subnet defines a CIDR block, which is required to create the Linode VPC subnet. An empty subnet.CIDR fails validation with this error, reported under the subnet's name.

Solutions

  1. Set cidr on each subnet in cluster.spec.networking.subnets (e.g. 10.0.0.0/24).
  2. Verify the YAML key is cidr per the kops v1alpha2/v1beta1 API, not cidrBlock.
  3. Ensure the CIDR does not overlap other subnets in the cluster VPC.
  4. Re-run kops update cluster after fixing.

Example fix

// before
- name: us-east-1a
  region: us-east
// after
- name: us-east-1a
  region: us-east
  cidr: 10.0.0.0/24
Defensive patterns

Strategy: validation

Validate before calling

for _, s := range cluster.Spec.Networking.Subnets {
    if s.CIDR == "" {
        return fmt.Errorf("subnet %q missing cidr", s.Name)
    }
    if _, _, err := net.ParseCIDR(s.CIDR); err != nil {
        return fmt.Errorf("subnet %q has invalid cidr %q", s.Name, s.CIDR)
    }
}

Prevention

When it happens

Trigger: A cluster.spec.networking.subnets entry with name and region set but cidr omitted, empty, or under a wrong key (e.g. cidrBlock instead of cidr).

Common situations: Manifests copied from providers with different CIDR field names; templating leaving the cidr variable unsubstituted; hand-edited specs where the CIDR line was deleted.

Related errors


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

Appendix: source

Thrown at pkg/model/linodemodel/network.go:55

		return fmt.Errorf("linode VPC requires at least one subnet")
	}

	seenSubnetNames := map[string]string{}
	region := ""
	for i, subnet := range b.Cluster.Spec.Networking.Subnets {
		subnetName := subnet.Name
		if subnetName == "" {
			subnetName = fmt.Sprintf("subnet %d", i)
		}

		if subnet.Name == "" {
			return fmt.Errorf("linode subnet %q requires a name", subnetName)
		}
		if subnet.Region == "" {
			return fmt.Errorf("linode subnet %q requires a region", subnetName)
		}
		if subnet.CIDR == "" {
			return fmt.Errorf("linode subnet %q requires a CIDR", subnetName)
		}

		normalizedSubnetName := linode.NormalizeLinodeLabel(b.ClusterName() + "-" + subnet.Name)
		if previousSubnetName, found := seenSubnetNames[normalizedSubnetName]; found {
			return fmt.Errorf("linode subnets %q and %q normalize to the same label %q", previousSubnetName, subnetName, normalizedSubnetName)
		}
		seenSubnetNames[normalizedSubnetName] = subnetName

		if region == "" {
			region = subnet.Region
			continue
		}
		if subnet.Region != region {
			return fmt.Errorf("linode subnets must all use the same region; found %q and %q", region, subnet.Region)
		}
	}

	name := linode.NormalizeLinodeLabel(b.ClusterName())

View on GitHub (pinned to 4c8573c808)