kubernetes/kops · error

error listing instance templates

Error message

error listing instance templates: %v

What it means

Wraps the compute InstanceTemplates().List failure in FindInstanceTemplates, which locates a cluster's templates by cluster-name metadata. Fires when the list API call errors (permissions, quota, connectivity).

Solutions

  1. Verify compute.instanceTemplates.list permission
  2. Check API quota and network access
  3. Retry after transient failures
Defensive patterns

Strategy: try-catch

When it happens

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

Appendix: source

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

		}

		ingresses = append(ingresses, fi.ApiIngressStatus{
			InternalEndpoint: internalEndpoint,
			IP:               forwardingRule.IPAddress,
		})
	}

	return ingresses, nil
}

// FindInstanceTemplates finds all instance templates that are associated with the current cluster
// It matches them by looking for instance metadata with key='cluster-name' and value of our cluster name
func FindInstanceTemplates(c GCECloud, clusterName string) ([]*compute.InstanceTemplate, error) {
	findClusterName := strings.TrimSpace(clusterName)

	ts, err := c.Compute().InstanceTemplates().List(context.Background(), c.Project())
	if err != nil {
		return nil, fmt.Errorf("error listing instance templates: %v", err)
	}

	var matches []*compute.InstanceTemplate
	for _, t := range ts {
		if !gcemetadata.MetadataMatchesClusterName(findClusterName, t.Properties.Metadata) {
			continue
		}

		matches = append(matches, t)
	}

	return matches, nil
}

// logTokenInfo returns information about the active credential
func (c *gceCloudImplementation) getTokenInfo(ctx context.Context) (*oauth2.Tokeninfo, error) {
	tokenSource, err := google.DefaultTokenSource(ctx, compute.CloudPlatformScope)
	if err != nil {

View on GitHub (pinned to 4c8573c808)