--terminated-pod-gc-threshold argument is set as appropriate

kubernetes

Classification:

compliance

Framework:

cis-kubernetes

Control:

1.3.1

Set up the kubernetes integration.

Description

Activate garbage collector on pod termination, as appropriate.

Rationale

Garbage collection is important to ensure sufficient resource availability and avoiding degraded performance and availability. In the worst case, the system might crash or just be unusable for a long period of time. The current setting for garbage collection is 12,500 terminated pods which might be too high for your system to sustain. Based on your system resources and tests, choose an appropriate threshold value to activate garbage collection.

Audit

Run the following command on the master node:

ps -ef | grep kube-controller-manager

Verify that the --terminated-pod-gc-threshold argument is set as appropriate.

Remediation

Edit the Controller Manager pod specification file /etc/kubernetes/manifests/kube-controller-manager.yaml on the master node and set the --terminated-pod-gc-threshold to an appropriate threshold, for example: --terminated-pod-gc-threshold=10

Impact

None

Default value

By default, --terminated-pod-gc-threshold is set to 12500.

References

  1. https://kubernetes.io/docs/admin/kube-controller-manager/
  2. https://github.com/kubernetes/kubernetes/issues/28484

CIS controls

Version 6.14 Controlled Access Based on the Need to Know

Version 7.4 Controlled Use of Administrative Privileges