<p><strong>My set up</strong></p>
<p>I have one physical node K8s cluster where I taint master node so it can also act a worker. the node has Centos7 with total of 512 GB memory. I am limiting my experiments to one node cluster; once a solution is found, I  will test it on my small scale k8s cluster where master and worker services are on separate nodes.</p>
<p><strong>What I am trying to do</strong></p>
<p>I want k8s worker to use only 256GB of memory to begin with. later on with if a particular node condition is met I want to increase memory allocation for k8s worker to  (lets say) 400GB</p>
<p><strong>Where I am right now with this</strong></p>
<ol>
<li>I reboot my machine and node is up with full 512 GB memory.</li>
<li>I use <code>chmem -d &lt;range&gt;</code> to offline 256 GB memory.  Now OS only sees 256 GB memory is available.</li>
<li>I follow steps from  <code>kubeadm init</code>  to <code>kubectl taint  nodes --all node-role.kubernetes.io/master-</code></li>
<li>My single node K8s set is up and I can deploy upto 2 pods. each pod requests 100Gi and limited to 200Gi memory usage. Pod are executing <code>sleep 100000</code>. so there is no memory stress.</li>
<li>When I try to launch third pod; pod is stuck in pending state because scheduler detects that the only worker node its managing is out of allocatable memory resource.  This make sense. the third pod is simply stuck in pending state forever.</li>
<li>Now after some time; the node met the required condition; at this point I used <code>chmem -e &lt;range&gt;</code> to enable some memory and now OS sees 400GB.</li>
<li>At this point I want to make k8s worker aware of this memory resource capacity change so the third pod stuck in pending stage can be deployed.</li>
<li>This is where I need your help. how can I update memory resource capacity of a worker without restarting my k8s. If I restart the cluster, it can see 400GB memory; but it means I need to kill already running pods and killing already running pod is not acceptable.</li>
</ol>

ankit patel
<p>It's a long shot, but you can try to restart kubelet via <code>systemctl restart kubelet</code>. The containers should not be restarted this way and there's a hope that once restarted, it'll notice the increased memory configuration.</p>
