<p>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:</p>

<pre><code>apiVersion: kubeadm.k8s.io/v1beta1
kind: ClusterConfiguration
networking:
  podSubnet: &lt;subnet&gt;
---
apiVersion: kubelet.config.k8s.io/v1beta1
kind: KubeletConfiguration
maxPods: 10
</code></pre>

<p>This is not quite well because the limit is applied even on master node (where multiple kube-system pods are running and the number of pods here may increase over 10).
I would like to keep the default value at init and change the value at join on each node.
I have found something:</p>

<pre><code>apiVersion: kubelet.config.k8s.io/v1beta1
kind: KubeletConfiguration
maxPods: 10
---
apiVersion: kubeadm.k8s.io/v1beta1
kind: JoinConfiguration
discovery:
  bootstrapToken:
    apiServerEndpoint: "&lt;api_endpoint&gt;"
    token: "&lt;token&gt;"
    unsafeSkipCAVerification: true
</code></pre>

<p>but, even if no error/warning appears, it seems that the value of maxPods is ignored. I can create more than 10 pods for that specific node.
Also <code>kubectl get node &lt;node&gt; -o yaml</code> <code>returns status.capacity.pods</code> with its default value (110).
How can I proceed in order to have this pods limit applied per each node?</p>

<p>I would like to mention that I have basic/limited knowledge related to Kubernetes.</p>

<p>Thank you!</p>

<p>There is a config.yaml file at <code>/var/lib/kubelet</code>. 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.</p>

<pre><code>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
</code></pre>

<p>You can change that file and add maxPods parameter and then restart kubelet on the node.</p>

<pre><code>sudo systemctl restart kubelet 
</code></pre>

<p>Currently in kubeadm join there is no way to pass a kubelet config file.</p>
