kubernetes/kops · error

unable to fetch droplet id

Error message

unable to fetch droplet id: %w

What it means

Wraps GetDropletID failure in the DO bootstrap authenticator: the node could not read its own droplet ID from the DigitalOcean metadata service (169.254.169.254), so the node identity token cannot be created.

Solutions

  1. Verify the droplet metadata service is reachable from the node
  2. Check the wrapped error: network failure vs non-200 response
  3. Ensure nodeup/kops-controller runs on an actual DigitalOcean droplet
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at upup/pkg/fi/cloudup/do/dometadata/authenticator.go:44 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/f9bed78269079b02. Report an issue: GitHub.

Appendix: source

Thrown at upup/pkg/fi/cloudup/do/dometadata/authenticator.go:44

	"k8s.io/kops/pkg/bootstrap"
)

const DOAuthenticationTokenPrefix = "x-digitalocean-droplet-id "

type doAuthenticator struct {
}

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

func NewAuthenticator() (bootstrap.Authenticator, error) {
	return &doAuthenticator{}, nil
}

func (o *doAuthenticator) CreateToken(body []byte) (string, error) {
	dropletID, err := GetDropletID()
	if err != nil {
		return "", fmt.Errorf("unable to fetch droplet id: %w", err)
	}
	return DOAuthenticationTokenPrefix + dropletID, nil
}

const (
	dropletIDMetadataURL = "http://169.254.169.254/metadata/v1/id"
)

// GetDropletID returns the droplet ID from the metadata service.
func GetDropletID() (string, error) {
	return getMetadata(dropletIDMetadataURL)
}

func getMetadata(url string) (string, error) {
	resp, err := http.Get(url)
	if err != nil {
		return "", fmt.Errorf("error querying droplet metadata: %w", err)
	}

View on GitHub (pinned to 4c8573c808)