kubernetes/kops · error

compute project %q did not have DefaultServiceAccount

Error message

compute project %q did not have DefaultServiceAccount

What it means

Validation guard in ServiceAccount: the project info was fetched successfully but DefaultServiceAccount is empty, meaning the GCE project has no default compute service account (e.g. it was disabled or the project uses only user-managed service accounts).

Source

Thrown at upup/pkg/fi/cloudup/gce/gce_cloud.go:257

func (c *gceCloudImplementation) Project() string {
	return c.project
}

// ServiceAccount returns the email address for the service account that the instances will run under.
func (c *gceCloudImplementation) ServiceAccount() (string, error) {
	if c.projectInfo == nil {
		// Find the project info from the compute API, which includes the default service account
		klog.V(2).Infof("fetching project %q from compute API", c.project)
		p, err := c.compute.Projects().Get(c.project)
		if err != nil {
			return "", fmt.Errorf("error fetching info for project %q: %v", c.project, err)
		}

		c.projectInfo = p
	}

	if c.projectInfo.DefaultServiceAccount == "" {
		return "", fmt.Errorf("compute project %q did not have DefaultServiceAccount", c.project)
	}

	return c.projectInfo.DefaultServiceAccount, nil
}

func (c *gceCloudImplementation) DNS() (dnsprovider.Interface, error) {
	provider, err := clouddns.CreateInterface(c.project, nil)
	if err != nil {
		return nil, fmt.Errorf("error building (k8s) DNS provider: %v", err)
	}
	return provider, nil
}

func (c *gceCloudImplementation) FindVPCInfo(id string) (*fi.VPCInfo, error) {
	klog.Warningf("FindVPCInfo not (yet) implemented on GCE")
	return nil, nil
}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Enable/recreate the default Compute Engine service account for the project
  2. Or configure instances to use an explicit service account in the cluster spec
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at upup/pkg/fi/cloudup/gce/gce_cloud.go:257 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/efaf2a0c69648bf6. Report an issue: GitHub.