kubernetes/kops · error

project is required for GCE - try gcloud config get-value pr

Error message

project is required for GCE - try gcloud config get-value project

What it means

A configuration validation in BuildCloud for GCE clusters: the region was resolved from subnets, but spec.cloudProvider.gce.project is empty, so kOps has no GCP project to target for authentication and resource operations. The message even suggests the gcloud command to find the correct project value.

Source

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

	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
		}

	case kops.CloudProviderAWS:
		{
			region, err := awsup.FindRegion(cluster)
			if err != nil {
				return nil, err

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Set spec.cloudProvider.gce.project to your GCP project ID (find it with: gcloud config get-value project)
  2. Re-run the operation after kops edit cluster saves the project
  3. Ensure application-default credentials are initialized too (gcloud auth application-default login)
Defensive patterns

Strategy: validation

When it happens

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