More Info:
Explicitly set a service account public key file for service accounts on the apiserverRisk Level
MediumAddress
SecurityCompliance Standards
- CIS Kubernetes
Triage and Remediation
- Remediation
Remediation
Manual Steps
Manual Steps
-
On every control plane node, back up the current API server manifest:
-
Ensure a service account public key file exists on the node (example path used below); if you already have a specific key file, skip this generation and use that path instead:
-
Edit the API server pod specification file on the control plane node:
In the
spec.containers[0].commandlist, add (or update) the argument so there is a line like:Ensure the path matches the actual public key file you intend to use. -
If the public key file is not already available inside the kube-apiserver container, add/ensure a hostPath volume and volumeMount in the same manifest so the file is accessible:
Save and exit the editor. Editing this static pod manifest will cause the kubelet to automatically restart the kube-apiserver pod.
-
Wait for the kube-apiserver pod to restart and become Running:
(If
crictlis not available, use the node’s container runtime CLI to confirm the kube-apiserver container is running.) -
Verify that the kube-apiserver process is now using the
--service-account-key-fileargument with the correct path:
Using kubectl
Using kubectl
kubectl cannot be used to configure the API server’s
--service-account-key-file flag because it is set in the static pod manifest on each control plane node. To remediate this finding, edit /etc/kubernetes/manifests/kube-apiserver.yaml directly on every control plane node as described in the Manual Steps section.Automation
Automation

