kubernetes/kops · error

error describing subnet

Error message

error describing subnet %s: %v

What it means

setupVPC (AWS branch) wraps the EC2 DescribeSubnets error when looking up the first provided subnet ID to infer the cluster's VPC. It fires when --subnet-ids were given without --networkid and the AWS API call fails (bad subnet ID, auth, region, network).

Solutions

  1. Verify the subnet IDs exist in the target region and account
  2. Check AWS credentials and region configuration
  3. Pass --networkid explicitly to skip subnet lookup
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at upup/pkg/fi/cloudup/new_cluster.go:652 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/c143224aab3670d3. Report an issue: GitHub.

Appendix: source

Thrown at upup/pkg/fi/cloudup/new_cluster.go:652

		return "", false, fmt.Errorf("kubernetes feature gate must include a feature name")
	}

	return featureGate, enabled, nil
}

func setupVPC(opt *NewClusterOptions, cluster *api.Cluster, cloud fi.Cloud) error {
	ctx := context.TODO()
	cluster.Spec.Networking.NetworkID = opt.NetworkID

	switch cluster.GetCloudProvider() {
	case api.CloudProviderAWS:
		if cluster.Spec.Networking.NetworkID == "" && len(opt.SubnetIDs) > 0 {
			awsCloud := cloud.(awsup.AWSCloud)
			res, err := awsCloud.EC2().DescribeSubnets(ctx, &ec2.DescribeSubnetsInput{
				SubnetIds: []string{opt.SubnetIDs[0]},
			})
			if err != nil {
				return fmt.Errorf("error describing subnet %s: %v", opt.SubnetIDs[0], err)
			}
			if len(res.Subnets) == 0 || res.Subnets[0].VpcId == nil {
				return fmt.Errorf("failed to determine VPC id of subnet %s", opt.SubnetIDs[0])
			}
			cluster.Spec.Networking.NetworkID = *res.Subnets[0].VpcId
		}

		if featureflag.Spotinst.Enabled() {
			if opt.SpotinstProduct != "" {
				cluster.Spec.CloudProvider.AWS.SpotinstProduct = new(opt.SpotinstProduct)
			}
			if opt.SpotinstOrientation != "" {
				cluster.Spec.CloudProvider.AWS.SpotinstOrientation = new(opt.SpotinstOrientation)
			}
		}

	case api.CloudProviderGCE:
		if cluster.Spec.CloudConfig == nil {

View on GitHub (pinned to 4c8573c808)