kubernetes/kops · error

error getting instance from metadata: %w

Error message

error getting instance from metadata: %w

What it means

Same initializer: metadata.InstanceName failure while fetching the instance name from the GCE metadata server. Along with projectID and zone, the instance name is required to build the tpmAuthenticator; any of the three failing means node bootstrap authentication cannot proceed.

Source

Thrown at upup/pkg/fi/cloudup/gce/tpm/gcetpmsigner/tpmauthenticator.go:56

	projectID string
	zone      string
	instance  string
}

var _ bootstrap.Authenticator = (*tpmAuthenticator)(nil)

func NewTPMAuthenticator() (bootstrap.Authenticator, error) {
	projectID, err := metadata.ProjectID()
	if err != nil {
		return nil, fmt.Errorf("error getting projectID from metadata: %w", err)
	}
	zone, err := metadata.Zone()
	if err != nil {
		return nil, fmt.Errorf("error getting zone from metadata: %w", err)
	}
	instance, err := metadata.InstanceName()
	if err != nil {
		return nil, fmt.Errorf("error getting instance from metadata: %w", err)
	}

	return &tpmAuthenticator{
		projectID: projectID,
		zone:      zone,
		instance:  instance,
	}, nil
}

func (a *tpmAuthenticator) CreateToken(body []byte) (string, error) {
	requestHash := sha256.Sum256(body)

	tpmStart := time.Now()

	tpmDevice, err := openTPM()
	if err != nil {
		return "", fmt.Errorf("failed to open TPM: %w", err)
	}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Run on a GCE instance with metadata access
  2. Check metadata server reachability
  3. Inspect the wrapped error
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at upup/pkg/fi/cloudup/gce/tpm/gcetpmsigner/tpmauthenticator.go:56 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/685e54ca8522f64d. Report an issue: GitHub.