liveBook · Manning

TokenRequest API

As explained in Acing the Certified Kubernetes Administrator Exam, Second Edition

The TokenRequest API is a Kubernetes API interface for obtaining tokens associated with Service Accounts.

The TokenRequest API provides Service Account credentials for pods that need to authenticate to the Kubernetes API. Kubernetes mounts these credentials through a projected volume rather than creating long-lived token Secrets by default. section 3.3 section 3.1

Operational points to remember:

  • Works with RBAC: authentication identifies the Service Account, while roles and role bindings determine permitted operations. section 3.1
  • Replaces the older pattern of automatically generated long-term credential Secrets in newer Kubernetes versions. section 3.3

Verify a pod's projected Service Account token

After creating an nginx pod, run `kubectl get po nginx -o yaml | grep volumeMounts -A14` to confirm the Service Account mount. Then use `kubectl exec -it nginx -- sh` and read `/var/run/secrets/kubernetes.io/serviceaccount/token` to inspect the mounted credential.

How Acing the Certified Kubernetes Administrator Exam, Second Edition covers it

How deep it goes
Explains token lifetime, projected mounting, and older Secret-based credentials, but does not detail direct TokenRequest request syntax.
Examples
Demonstrates nginx volume inspection, container token reading, and short-lived-token behavior.
What it assumes
Assumes Service Account and Kubernetes API concepts while relating authentication to RBAC authorization.
What you can do after
Diagnose pod API credentials by verifying Service Account mounts and inspecting the projected token path.
How it connects
Connects Service Accounts, pods, projected volumes, RBAC, roles, role bindings, and Secrets.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Acing the Certified Kubernetes Administrator Exam, Second Edition. The section links point to the parts of the book it draws on.