Tuning Kubelet Garbage Collection & Eviction Thresholds for Devicemapper

Problem

Kubelet does not perform garbage collection with Docker as the underlying Container Runtime using the Device Mapperarrow-up-right storage driver.

Environment

  • Platform9 Managed Kubernetes – All Versions

  • Kubelet

  • Docker

  • Devicemapper

Cause

Due to a an alleged discrepancyarrow-up-right in the Kubernetes code, and based on observations made when querying the Kubelet resource metricsarrow-up-right, it appears that Kubelet does not properly record the image filesystem usage based on the DM thin-pool; rather, the disk capacity is based on the root disk.

Resolution

  1. Stop the Hostagent and Nodelet daemon services on each worker node.

systemctl stop pf9-{hostagent,nodeletd}
circle-exclamation
  1. Issue a stop for the Nodelet phases.

circle-exclamation
  1. Start the Hostagent service.

Option B: Tune Kubelet Parameters for Garbage Collection & Eviction Thresholds

  1. Run the docker info command on the worker node and identify the Data loop file .

  1. Check the size of the disk/partition on which the data loop file exists and note it down.

  1. Check the size of the data loop file itself and note it down also.

  1. Backup the current worker ConfigMap – worker-default-kubelet-config .

  1. Edit the worker-default-kubelet-config ConfigMap, and set the following parameters for Garbage Collection (GC) and Eviction Thresholds.

  1. (If necessary, should Kubelet not consume the updated configuration automatically.) Restart the Kubelet service on the worker(s).

Troubleshooting

Scenario: Kubelet Crashed

If Kubelet has crashed with an unexplainable stacktrace or error, it is likely that there was an error in the configuration. Take the following steps to restore the worker(s).

  1. Backup the Kubelet dynamic configuration directory.

  1. Recursively remove the directory.

  1. Restart the Kubelet service.

Additional Information

Last updated