kubernetes/kops · error

error creating subnet: %v

Error message

error creating subnet: %v

What it means

CreateSubnet failed while creating the subnet — commonly a CIDR collision with another subnet in the VPC, an invalid IPv6 CIDR, or an availability-zone mismatch; the wrapped error is the AWS API response.

Source

Thrown at upup/pkg/fi/cloudup/awstasks/subnet.go:283

	if a == nil {
		klog.V(2).Infof("Creating Subnet with CIDR: %q IPv6CIDR: %q", fi.ValueOf(e.CIDR), fi.ValueOf(e.IPv6CIDR))

		request := &ec2.CreateSubnetInput{
			CidrBlock:         e.CIDR,
			Ipv6CidrBlock:     e.IPv6CIDR,
			AvailabilityZone:  e.AvailabilityZone,
			VpcId:             e.VPC.ID,
			TagSpecifications: awsup.EC2TagSpecification(ec2types.ResourceTypeSubnet, e.Tags),
		}

		if e.CIDR == nil {
			request.Ipv6Native = aws.Bool(true)
		}

		response, err := t.Cloud.EC2().CreateSubnet(ctx, request)
		if err != nil {
			return fmt.Errorf("error creating subnet: %v", err)
		}

		e.ID = response.Subnet.SubnetId
	} else {
		if changes.IPv6CIDR != nil {
			request := &ec2.AssociateSubnetCidrBlockInput{
				Ipv6CidrBlock: e.IPv6CIDR,
				SubnetId:      e.ID,
			}

			_, err := t.Cloud.EC2().AssociateSubnetCidrBlock(ctx, request)
			if err != nil {
				return fmt.Errorf("error associating subnet cidr block: %v", err)
			}
		}
	}

	if a == nil || changes.AssignIPv6AddressOnCreation != nil {

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Ensure the subnet CIDR does not overlap other subnets in the VPC
  2. Check the availability zone is valid for the region
  3. Verify IPv6 CIDR hints are consistent with the VPC's IPv6 block
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at upup/pkg/fi/cloudup/awstasks/subnet.go:283 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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