I\'m trying to limit the number of pods per each node from my cluster. I managed to add a global limit per node from kubeadm init with config file:
apiVersio
You can also set the maximum number of pods per node with the kubelet --max-pods
option.
There is a config.yaml file at /var/lib/kubelet
. This config file is generated from kubelet config map in kube-system namespace when you run kubeadm join.Partial content of the file is as below.
apiVersion: kubelet.config.k8s.io/v1beta1
authentication:
anonymous:
enabled: false
webhook:
cacheTTL: 0s
enabled: true
x509:
clientCAFile: /etc/kubernetes/pki/ca.crt
authorization:
mode: Webhook
webhook:
cacheAuthorizedTTL: 0s
cacheUnauthorizedTTL: 0s
clusterDNS:
- 10.96.0.10
maxPods: 10
You can change that file and add maxPods parameter and then restart kubelet on the node.
sudo systemctl restart kubelet
Currently in kubeadm join there is no way to pass a kubelet config file.