kubernetes/kops · error

unable to fetch Akamai (Linode) instance id: %w

Error message

unable to fetch Akamai (Linode) instance id: %w

What it means

CreateToken fails because the HTTP GET to the Linode metadata service /v1/instance (used to read the instance ID) returned an error or empty ID. It fires on instances where the metadata service is unreachable, disabled, or returned a non-200 response, so no x-linode-instance-id token can be minted.

Source

Thrown at upup/pkg/fi/cloudup/linode/linodemetadata/authenticator.go:61

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

// NewLinodeAuthenticator returns a bootstrap.Authenticator that can create
// authentication tokens for Akamai (Linode) instances by querying the Akamai (Linode) metadata
// service for the instance ID and returning it prefixed with "x-linode-instance-id".
func NewLinodeAuthenticator() (bootstrap.Authenticator, error) {
	return &linodeAuthenticator{
		client:          http.DefaultClient,
		metadataBaseURL: linodeMetadataBaseURL,
	}, nil
}

// CreateToken queries the Akamai (Linode) metadata service for the instance ID and returns
// it prefixed with "x-linode-instance-id ".
func (a *linodeAuthenticator) CreateToken(body []byte) (string, error) {
	instanceID, err := getLinodeMetadataValue(context.TODO(), a.client, a.metadataBaseURL, "id")
	if err != nil {
		return "", fmt.Errorf("unable to fetch Akamai (Linode) instance id: %w", err)
	}

	return LinodeAuthenticationTokenPrefix + instanceID, nil
}

// GetMetadataValue fetches the given field from the Akamai (Linode) instance metadata service
// using the standard metadata endpoint and default HTTP client.
func GetMetadataValue(ctx context.Context, key string) (string, error) {
	return getLinodeMetadataValue(ctx, http.DefaultClient, linodeMetadataBaseURL, key)
}

// getLinodeMetadataValue queries the Akamai (Linode) metadata service for the given key
// and returns the value as a string.
func getLinodeMetadataValue(ctx context.Context, client *http.Client, metadataBaseURL, key string) (string, error) {
	tokenReq, err := http.NewRequestWithContext(ctx, http.MethodPut, metadataBaseURL+"/v1/token", nil)
	if err != nil {
		return "", fmt.Errorf("building metadata token request: %w", err)
	}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Verify the instance metadata service is enabled for the Linode instance
  2. Check network connectivity to the metadata endpoint from the node
  3. Confirm the requesting context is not cancelled or timed out before the metadata call completes
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at upup/pkg/fi/cloudup/linode/linodemetadata/authenticator.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/ab657ef8a0b33948. Report an issue: GitHub.