Skip to content

Instructions for obtaining Kubernetes service account token manually are incorrect #13844

@liggitt

Description

@liggitt

Describe the bug

https://github.com/hashicorp/vault/blob/main/website/content/docs/auth/kubernetes.mdx describes how to obtain a Kubernetes service account token manually as:

kubectl get secret "$(kubectl get serviceaccount default -o jsonpath='{.secrets[0].name}')"

This is scraping an auto-generated token, rather than requesting one for external use. The auto-generated tokens are only intended for mounting into pods, and with the transition away from secret-based tokens in Kubernetes 1.22+, new secret-based tokens will no longer be auto-generated in future Kubernetes releases (planned starting in Kubernetes 1.24).

While use of secret-based tokens is discouraged due to their weaker security properties, if one is still needed, https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/#manually-create-a-service-account-api-token has instructions for manually creating a secret to contain a long-lived token.

https://github.com/hashicorp/vault/blob/main/website/content/docs/auth/kubernetes.mdx should update to align with or reference those instructions.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions