Skip to main content

More Info:

Setting tlsCertFile and tlsPrivateKeyFile provides the kubelet with a proper serving certificate and key for its API. This ensures kubelet connections are secured with trusted TLS material.

Risk Level

Medium

Address

Security

Compliance Standards

  • CIS Kubernetes

Triage and Remediation

Remediation

Manual Steps

  1. On every control plane node, identify the current API server manifest and TLS files:
    Decide which existing certificate/key pair you will use (for example, /etc/kubernetes/pki/apiserver.crt and /etc/kubernetes/pki/apiserver.key), or provision new ones according to your PKI policy.
  2. If you need to generate a new serving certificate and key for the API server on this control plane node, create them (example using openssl; adjust CN/SANs to match your cluster and certificate policy):
  3. On every control plane node, edit the API server static pod manifest to set the TLS certificate and key flags (this edit will automatically restart the kube-apiserver pod when you save the file):
    In the command: section of the kube-apiserver container, ensure the following lines exist and point to the chosen files (adjust paths if different):
    Save and exit; kubelet will detect the manifest change and restart the API server pod with the new flags.
  4. If the certificate and key are not yet mounted into the API server container path, ensure the manifest has appropriate volume and volumeMount entries (still on every control plane node editing /etc/kubernetes/manifests/kube-apiserver.yaml):
    Save the file; kubelet will restart the API server pod again if you changed volumes.
  5. After waiting 30–60 seconds for the static pod to restart, verify on each control plane node that the kube-apiserver process is running with the required flags:
    Confirm the output includes both --tls-cert-file=/etc/kubernetes/pki/apiserver.crt and --tls-private-key-file=/etc/kubernetes/pki/apiserver.key (or your chosen paths) for the running kube-apiserver process.
kubectl cannot modify kube-apiserver process flags or the static pod manifest on the node. This finding must be fixed by editing /etc/kubernetes/manifests/kube-apiserver.yaml and related TLS files directly on every control plane node; see the Manual Steps section for exact host-level instructions.