Description
Static bearer tokens loaded through --token-auth-file do not expire automatically. An API server must restart to pick up changes to the token list.
Potential impact
A leaked token or file can grant access with the user’s permissions until revocation takes effect on every API server.
Remediation
Test replacement authentication and permissions first, such as OIDC for people and short-lived service account tokens for workloads. Migrate clients, remove the flag from each API server and restart it. Retire unused files and distributed copies. Verify that new credentials work and the old tokens are rejected.
Examples
The Kubernetes 1.6 excerpts remove only the static-token file option. This method remains supported. If you keep it, restrict file access and token privileges and plan how to revoke tokens across all API servers.
Before
apiVersion: v1
kind: Pod
metadata:
name: api-server
spec:
containers:
- name: kube-apiserver
image: gcr.io/google_containers/kube-apiserver-amd64:v1.6.0
command:
- "kube-apiserver"
args:
- "--token-auth-file=/path/to/any/file"
After
apiVersion: v1
kind: Pod
metadata:
name: api-server
spec:
containers:
- name: kube-apiserver
image: gcr.io/google_containers/kube-apiserver-amd64:v1.6.0
command:
- "kube-apiserver"