More Info:
Verifies that the controller manager —terminated-pod-gc-threshold argument is set so terminated pods are garbage collected, preventing resource exhaustion.Risk Level
MediumAddress
SecurityCompliance Standards
- CIS Kubernetes
Triage and Remediation
- Remediation
Remediation
Manual Steps
Manual Steps
-
Back up the existing manifest (every control plane node)
-
Open the controller manager manifest for editing (every control plane node)
(Use any text editor you prefer.)
-
Set
--terminated-pod-gc-thresholdin the container args (every control plane node)
In thespec.containers[0].commandorspec.containers[0].argslist forkube-controller-manager, ensure there is an entry like the following (adjust the value as appropriate for your cluster policy, e.g.10):Save and exit the editor.Note: Editing this static pod manifest under
/etc/kubernetes/manifestswill cause the kube-controller-manager pod to be restarted automatically by the kubelet. -
Wait for the kube-controller-manager pod to restart cleanly (every control plane node)
From any machine withkubectland access to the cluster:Wait until the pod is back inRunningstatus and no longer restarting. -
Verify the running process includes the flag (every control plane node)
Confirm the output shows
--terminated-pod-gc-threshold=10(or the value you configured) in the kube-controller-manager process arguments.
Using kubectl
Using kubectl
kubectl cannot modify the kube-controller-manager arguments because they are defined in the static pod manifest
/etc/kubernetes/manifests/kube-controller-manager.yaml on each control plane node. To set --terminated-pod-gc-threshold, follow the instructions in the Manual Steps section on each control plane node.Automation
Automation

