kubernetes/kops · error
found multiple gcp regions for cluster
Error message
found multiple gcp regions for cluster
What it means
applyGCPCluster derives a single GCP region from the cluster subnets and rejects clusters whose subnets span more than one region, since a GCPCluster object is region-scoped. When two or more subnets have different Region values, reconciliation fails with this error.
Source
Thrown at pkg/controllers/clusterapi/cluster_controller.go:124
}
return nil
}
func (s *clusterScope) applyGCPCluster(ctx context.Context, kube client.Client) error {
// This is because of network tags in cloud-provider-gcp
// TODO: cloud-provider-gcp should not assume cluster name is a valid prefix
name := gce.SafeClusterName(s.Cluster.GetName())
gcpProject := s.Cluster.Spec.Project
if gcpProject == "" {
return fmt.Errorf("unable to determine gcp project for cluster")
}
gcpRegion := ""
for _, subnet := range s.Cluster.Spec.Subnets {
if gcpRegion == "" {
gcpRegion = subnet.Region
} else if gcpRegion != subnet.Region {
return fmt.Errorf("found multiple gcp regions for cluster")
}
}
if gcpRegion == "" {
return fmt.Errorf("unable to determine gcp region for cluster")
}
// TODO: Sync with LinkToNetwork
gcpNetworkName := s.Cluster.Spec.NetworkID
if gcpNetworkName == "" {
gcpNetworkName = gce.SafeTruncatedClusterName(s.Cluster.ObjectMeta.Name, 63)
}
if gcpNetworkName == "" {
return fmt.Errorf("unable to determine gcp network for cluster")
}
obj := map[string]any{
"apiVersion": "infrastructure.cluster.x-k8s.io/v1beta1",
"kind": "GCPCluster",View on GitHub (pinned to 4c8573c808)
Solutions
- Make all subnets belong to the same GCP region
- Split the multi-region deployment into separate clusters per region
- Fix the subnet region values if they were set incorrectly
Example fix
// before subnets: - name: us-west1 region: us-west1 - name: us-east1 region: us-east1 // after subnets: - name: us-west1 region: us-west1 - name: us-west1-b region: us-west1
Defensive patterns
Strategy: validation
Validate before calling
regions := map[string]bool{}
for _, s := range cluster.Spec.Subnets {
regions[s.Region] = true
}
if len(regions) > 1 {
return fmt.Errorf("CAPI GCP clusters must be single-region; found %d regions", len(regions))
} Prevention
- Keep all subnets of a CAPI-managed GCP cluster in one region
- Split multi-region topologies across separate clusters
- Validate region consistency before applying manifests
When it happens
Trigger: clusterScope.Apply() iterating Cluster.Spec.Subnets finds subnet[0].Region != subnet[i].Region for any i.
Common situations: Multi-region GCP cluster specs fed into the CAPI controller; copy-paste of subnet definitions from multi-region clusters; editing subnets to add a region for HA without understanding CAPI's single-region constraint.
Related errors
- unable to determine gcp region for cluster
- unable to determine gcp project for cluster
- unable to determine gcp network for cluster
- applying GCPCluster object to cluster: %w
- instance was in zone %q, expected region %q
AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05).
Data as JSON: /api/errors/60f8f9d4cb1f55d7.
Report an issue: GitHub.