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
HighAddress
SecurityCompliance Standards
- CIS Kubernetes
Triage and Remediation
- Remediation
Remediation
Manual Steps
Manual Steps
-
On every control plane node, confirm the current kube-apiserver static pod manifest path and back it up:
-
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.) -
On every control plane node, edit the kube-apiserver static pod manifest to add the
--service-account-key-fileflag pointing to the public key file. Use a text editor:Under thecommand:section forkube-apiserver, add a line similar to:Keep the YAML indentation consistent with the existing list of- --...flags. -
On every control plane node, if the public key file is not already mounted into the kube-apiserver container, add a corresponding
volumeMountsentry andvolumesentry in/etc/kubernetes/manifests/kube-apiserver.yamlso the container can read/etc/kubernetes/pki/sa.pub. For example, in the container spec:And in the pod-levelvolumes::(Adjust names if a similar volume already exists; do not create duplicates.) - 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.
-
On every control plane node, verify that the kube-apiserver is now running with the
--service-account-key-fileargument set to the intended public key file:Confirm the output includes a flag like:
Using kubectl
Using kubectl
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.Automation
Automation

