<p>I have tried setting max nodes per pod using the following upon install:</p>
<pre class="lang-sh prettyprint-override"><code>curl -sfL https://get.k3s.io | INSTALL_K3S_EXEC=&quot;--max-pods 250&quot; sh -s -
</code></pre>
<p>However, the K3s server will then fail to load. It appears that the <code>--max-pods</code> flag has been deprecated per the <a href="https://kubernetes.io/docs/reference/command-line-tools-reference/kubelet/" rel="nofollow noreferrer">kubernetes docs</a>:</p>
<blockquote>
<p>--max-pods int32     Default: 110</p>
<p>(DEPRECATED: This parameter should be set via the config file
specified by the Kubelet's <code>--config</code> flag. See
<a href="https://kubernetes.io/docs/tasks/administer-cluster/kubelet-config-file/" rel="nofollow noreferrer">https://kubernetes.io/docs/tasks/administer-cluster/kubelet-config-file/</a>
for more information.)</p>
</blockquote>
<p>So with K3s, where is that kubelet config file and can/should it be set using something like the above method?</p>

<p>To update your existing installation with an increased max-pods, add a kubelet config file into a k3s associated location such as <code>/etc/rancher/k3s/kubelet.config</code>:</p>
<pre><code>apiVersion: kubelet.config.k8s.io/v1beta1
kind: KubeletConfiguration
maxPods: 250
</code></pre>
<p>edit <code>/etc/systemd/system/k3s.service</code> to change the k3s server args:</p>
<pre><code>ExecStart=/usr/local/bin/k3s \
    server \
        '--disable' \
        'servicelb' \
        '--disable' \
        'traefik' \
        '--kubelet-arg=config=/etc/rancher/k3s/kubelet.config'
</code></pre>
<p>reload systemctl to pick up the service change:</p>
<p><code>sudo systemctl daemon-reload</code></p>
<p>restart k3s:</p>
<p><code>sudo systemctl restart k3s</code></p>
<p>Check the output of describe nodes with <code>kubectl describe &lt;node&gt;</code> and look for allocatable resources:</p>
<pre><code>Allocatable:
  cpu:                32
  ephemeral-storage:  199789251223
  hugepages-1Gi:      0
  hugepages-2Mi:      0
  memory:             131811756Ki
  pods:               250
</code></pre>
<p>and a message noting that allocatable node limit has been updated in Events:</p>
<pre><code>Events:
  Type     Reason                   Age    From        Message
  ----     ------                   ----   ----        -------
  Normal   Starting                 20m    kube-proxy  Starting kube-proxy.
  Normal   Starting                 20m    kubelet     Starting kubelet.
...
  Normal   NodeNotReady             7m52s  kubelet     Node &lt;node&gt; status is now: NodeNotReady
  Normal   NodeAllocatableEnforced  7m50s  kubelet     Updated Node Allocatable limit across pods
  Normal   NodeReady                7m50s  kubelet     Node &lt;node&gt; status is now: NodeReady
</code></pre>
