kubernetes/kubernetes

Unclear with Container garbage collection configuration

Open

#127,157 opened on Sep 5, 2024

View on GitHub
 (12 comments) (0 reactions) (1 assignee)Go (122,268 stars) (43,066 forks)batch import
area/kubelethelp wantedkind/documentationneeds-kindpriority/important-longtermsig/nodetriage/accepted

Description

What happened?

Iam trying to disable maxPerPodContainer feature in my cluster. To achieve this followed the docs Container garbage collection and gone through code related to garbage collection.

Configured Container garbage collection parameters in the kubelet config file and restarted the kubelet sucessfully. After that if i check, values in kubelet configuration file are persist but those are actually not reflected in cluster.

What did you expect to happen?

Container garbage collection parameters which i added in config file should reflect in cluster.

minAge: maxPerPodContainer: maxContainers:

How can we reproduce it (as minimally and precisely as possible)?

Ex:

  1. Add below values in kubelet configuration file: /var/lib/kubelet/config.yaml
minAge: "5m"
maxPerPodContainer: 1
maxContainers: 50
  1. Restart kubelet service: sudo systemctl restart kubelet Make sure kubelet restarted sucessfully: sudo systemctl status kubelet

  2. Run: kubectl proxy

  3. Open another terminal and check whether added parameters are present in configuration or not: curl http://localhost:8001/api/v1/nodes/<hostname/proxy/configz

Anything else we need to know?

I tried many ways to add these parameters but no use. even these are not listed in api-resources. https://kubernetes.io/docs/reference/config-api/kubelet-config.v1beta1/ https://kubernetes.io/docs/reference/command-line-tools-reference/kubelet/

Is it possible to define these values in kubelet as mentioned in docs? if possible how can we configure them?

Kubernetes version

$ kubectl version
Client Version: v1.30.3
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
Server Version: v1.30.3

Cloud provider

OS version

# On Linux:
$ cat /etc/os-release
# paste output here
$ uname -a
# paste output here

# On Windows:
C:\> wmic os get Caption, Version, BuildNumber, OSArchitecture
# paste output here

Install tools

Container runtime (CRI) and version (if applicable)

Related plugins (CNI, CSI, ...) and versions (if applicable)

Contributor guide