More Info:
Activate garbage collector on pod termination, as appropriateRisk Level
LowAddress
SecurityCompliance Standards
- CIS Kubernetes
Triage and Remediation
- Remediation
Remediation
Manual Steps
Manual Steps
-
On every control plane node, back up the current manifest so you can roll back if needed:
-
On every control plane node, open the manifest for editing:
-
In the
spec.containers[0].commandorspec.containers[0].argslist, add or modify the terminated pod GC flag to the threshold you decide is appropriate for your cluster (example: 10). For example, ensure there is a line similar to:Place it alongside the other--flags forkube-controller-manager. Save and exit.
Note: Editing this static pod manifest will cause the kube-controller-manager pod to restart automatically. -
(Optional sanity check) Immediately after saving, confirm the static pod has been recreated and is running:
(Use whichever container runtime CLI is available on your node.)
-
On every control plane node, verify that the running process now includes the configured threshold value:
Confirm the output shows
--terminated-pod-gc-threshold=10(or your chosen value).
Using kubectl
Using kubectl
kubectl cannot modify the kube-controller-manager static pod manifest or its process flags, so this setting cannot be fixed through the Kubernetes API. To remediate, you must edit
/etc/kubernetes/manifests/kube-controller-manager.yaml directly on every control plane node; follow the instructions in the Manual Steps section.Automation
Automation

