Skip to main content

More Info:

Verifies that —service-account-key-file is set so the API server uses a dedicated key to verify service account tokens instead of the TLS serving key.

Risk Level

High

Address

Security

Compliance Standards

  • CIS Kubernetes

Triage and Remediation

Remediation

Manual Steps

  1. On every control plane node, confirm the current kube-apiserver static pod manifest path and back it up:
  2. On every control plane node, ensure you have a dedicated public key file for service accounts (for example /etc/kubernetes/pki/sa.pub). If you only have a private key (e.g. /etc/kubernetes/pki/sa.key), extract or create a matching public key as appropriate for your environment and place it at:
    (If the file is missing, follow your cluster’s key-management procedure to generate a service account keypair; this step is environment-specific and cannot be automated generically.)
  3. On every control plane node, edit the kube-apiserver static pod manifest to add the --service-account-key-file flag pointing to the public key file. Use a text editor:
    Under the command: section for kube-apiserver, add a line similar to:
    Keep the YAML indentation consistent with the existing list of - --... flags.
  4. On every control plane node, if the public key file is not already mounted into the kube-apiserver container, add a corresponding volumeMounts entry and volumes entry in /etc/kubernetes/manifests/kube-apiserver.yaml so the container can read /etc/kubernetes/pki/sa.pub. For example, in the container spec:
    And in the pod-level volumes::
    (Adjust names if a similar volume already exists; do not create duplicates.)
  5. On every control plane node, save the file and exit the editor. The kubelet will automatically detect the manifest change and restart the kube-apiserver static pod; expect a brief control-plane disruption during the restart.
  6. On every control plane node, verify that the kube-apiserver is now running with the --service-account-key-file argument set to the intended public key file:
    Confirm the output includes a flag like:
kubectl cannot modify the kube-apiserver static pod manifest or its process flags, so this finding cannot be fixed via the Kubernetes API. The required change must be made directly on each control plane node by editing /etc/kubernetes/manifests/kube-apiserver.yaml; see the Manual Steps section for exact host-level instructions.