Skip to main content

More Info:

Verifies that —audit-log-maxage is set to 30 days or an appropriate value so audit records are retained long enough for investigations.

Risk Level

Medium

Address

Security

Compliance Standards

  • CIS Kubernetes

Triage and Remediation

Remediation

Manual Steps

  1. On every control plane node, open the API server static pod manifest for editing:
  2. In the command: (or args:) list for kube-apiserver, add or modify the audit log max age flag so it is present exactly once and set to at least 30. For example, ensure there is a line like:
  3. Save and exit the file. The kubelet will automatically detect the change and restart the kube-apiserver static pod. Be aware this briefly restarts the API server on that node.
  4. Wait for the kube-apiserver pod to restart and become Running on that node:
    (Use docker ps instead of crictl if the node uses Docker.)
  5. Verify the kube-apiserver process now includes the correct --audit-log-maxage parameter on each control plane node:
kubectl cannot modify the kube-apiserver static pod manifest or its process flags, so it cannot be used to set --audit-log-maxage. This must be fixed directly on each control plane node by editing /etc/kubernetes/manifests/kube-apiserver.yaml; see the Manual Steps section for the exact procedure.