kubernetes/kops · error

zone flag is required for GCE clusters

Error message

zone flag is required for GCE clusters

What it means

After populating the IG spec for a GCE cluster, no zones were set (neither via --zone flags nor inferred). GCE requires explicit zones for instance groups, unlike AWS where subnets imply zones, so creation is blocked.

Source

Thrown at cmd/kops/create_instancegroup.go:224

	ig.Spec.Subnets = options.Subnets

	ig.Spec.Zones = options.Zones

	cloud, err := cloudup.BuildCloud(cluster)
	if err != nil {
		return err
	}

	ig, err = cloudup.PopulateInstanceGroupSpec(cluster, ig, cloud, channel)
	if err != nil {
		return err
	}

	ig.AddInstanceGroupNodeLabel()
	if cluster.GetCloudProvider() == kopsapi.CloudProviderGCE {
		if len(ig.Spec.Zones) == 0 {
			return fmt.Errorf("zone flag is required for GCE clusters")
		}
		fmt.Println("detected a GCE cluster; labeling nodes to receive metadata-proxy.")
		ig.Spec.NodeLabels["cloud.google.com/metadata-proxy-ready"] = "true"
	}

	if options.DryRun {

		if options.Output == "" {
			return fmt.Errorf("must set output flag; yaml or json")
		}

		// Cluster name is not populated, and we need it
		ig.ObjectMeta.Labels = make(map[string]string)
		ig.ObjectMeta.Labels[kopsapi.LabelClusterName] = cluster.ObjectMeta.Name

		switch options.Output {
		case OutputYaml:
			if err := fullOutputYAML(out, ig); err != nil {

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Pass --zone flags, e.g. --zone us-west1-a (comma-separated for multiple)
  2. Ensure the cluster subnets/zones configuration allows zone inference
  3. Re-run the command with at least one valid GCE zone
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at cmd/kops/create_instancegroup.go:224 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/c6b8f417a5c67847. Report an issue: GitHub.