kubernetes/kops · error

on GCE, subnets must include Regions

Error message

on GCE, subnets must include Regions

What it means

A configuration validation in BuildCloud for GCE clusters: none of the subnets under spec.networking.subnets has a Region set, so kOps cannot determine the GCP region for API clients. On GCE the region is discovered from subnet definitions rather than a dedicated field, so all-empty Regions leave the region unresolved.

Source

Thrown at upup/pkg/fi/cloudup/utils.go:56

)

func BuildCloud(cluster *kops.Cluster) (fi.Cloud, error) {
	var cloud fi.Cloud
	ctx := context.TODO()

	region := ""
	project := ""

	switch cluster.GetCloudProvider() {
	case kops.CloudProviderGCE:
		{
			for _, subnet := range cluster.Spec.Networking.Subnets {
				if subnet.Region != "" {
					region = subnet.Region
				}
			}
			if region == "" {
				return nil, fmt.Errorf("on GCE, subnets must include Regions")
			}

			project = cluster.Spec.CloudProvider.GCE.Project
			if project == "" {
				return nil, fmt.Errorf("project is required for GCE - try gcloud config get-value project")
			}

			clusterLabel := gce.LabelForCluster(cluster.ObjectMeta.Name)
			labels := map[string]string{clusterLabel.Key: clusterLabel.Value}

			gceCloud, err := gce.NewGCECloud(region, project, labels)
			if err != nil {
				return nil, err
			}

			cloud = gceCloud
		}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Edit the cluster spec and set region on at least one subnet in spec.networking.subnets (e.g. us-central1)
  2. Ensure subnets are defined with proper GCE regions when creating the cluster (kops edit cluster)
  3. For scripts, generate subnets from the target GCP region instead of leaving Region blank
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at upup/pkg/fi/cloudup/utils.go:56 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/92832b2956f3f814. Report an issue: GitHub.