Review service account token signing keys

Review kube-controller-manager signing keys if you issue legacy Secret-based service account tokens.

Description

--service-account-private-key-file on kube-controller-manager signs legacy Secret-based service account tokens. Configure signing for short-lived TokenRequest tokens on kube-apiserver.

Potential impact

A missing private key prevents the controller from issuing new legacy tokens. A mismatched verification key makes newly signed tokens fail authentication. Removing the signing key alone leaves previously issued tokens valid if still trusted. A leaked key can be used to forge tokens.

Remediation

Prefer expiring TokenRequest tokens. If an application still requires legacy tokens, mount the private key for the controller, restrict file access and verify that the API server trusts its corresponding verification key.

Examples

These Kubernetes 1.6 excerpts illustrate legacy token signing. Use a supported version and mount the actual key file at the configured path.

Before

yaml
apiVersion: v1
kind: Pod
metadata:
  name: command-demo
spec:
  containers:
    - name: command-demo-container
      image: gcr.io/google_containers/kube-controller-manager-amd64:v1.6.0
      command: ["kube-controller-manager"]
      args: []

After

yaml
apiVersion: v1
kind: Pod
metadata:
  name: command-demo
spec:
  containers:
    - name: command-demo-container
      image: gcr.io/google_containers/kube-controller-manager-amd64:v1.6.0
      command: ["kube-controller-manager"]
      args: ["--service-account-private-key-file=/path/to/key/file.pem"]

References