kubernetes/kops · error

error creating Subnet: %v

Error message

error creating Subnet: %v

What it means

Wrapped error from Subnet.RenderGCE when the synchronous Subnetworks.Insert call fails for a new subnet (a == nil). GCE rejected the create — common causes are CIDR overlap with another subnet, invalid StackType/secondary ranges, or a bad network self-link.

Source

Thrown at upup/pkg/fi/cloudup/gcetasks/subnet.go:144

		subnet := &compute.Subnetwork{
			IpCidrRange:    fi.ValueOf(e.CIDR),
			Name:           *e.Name,
			Network:        e.Network.URL(project),
			StackType:      fi.ValueOf(e.StackType),
			Ipv6AccessType: fi.ValueOf(e.Ipv6AccessType),
		}

		for k, v := range e.SecondaryIpRanges {
			subnet.SecondaryIpRanges = append(subnet.SecondaryIpRanges, &compute.SubnetworkSecondaryRange{
				RangeName:   k,
				IpCidrRange: v,
			})
		}

		op, err := cloud.Compute().Subnetworks().Insert(t.Cloud.Project(), t.Cloud.Region(), subnet)
		if err != nil {
			return fmt.Errorf("error creating Subnet: %v", err)
		}
		if err := t.Cloud.WaitForOp(op); err != nil {
			return fmt.Errorf("error waiting for Subnet creation to complete: %w", err)
		}
	} else {
		if changes.SecondaryIpRanges != nil {
			// Update is split into two calls as GCE does not allow us to add and remove ranges in the same call
			if err := updateSecondaryRanges(cloud, "add", e); err != nil {
				return err
			}

			if !shared {
				if err := updateSecondaryRanges(cloud, "remove", e); err != nil {
					return err
				}
			}

			changes.SecondaryIpRanges = nil

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Read the wrapped API error for the rejection reason
  2. Check that the subnet CIDR (and secondary ranges) do not overlap existing ranges in the network
  3. Verify StackType/Ipv6AccessType values and the referenced network, then re-run
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at upup/pkg/fi/cloudup/gcetasks/subnet.go:144 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/8ecf3f542c43a134. Report an issue: GitHub.