<p>Requst:limits of a pod may be set to low at the beginning, to make full use of node's resource, we need to set the limits higher. However, when the resource of node is not enough, to make the node's still work well, we need to set the limits lower. It is better not to kill the pod, because it may influence the cluster. </p>

<p>Background:I am currently a beginner in k8s and docker, my mentor give me this requests. Can this requests fullfill normaly? Or is it better way to solve this kind of problem? Thanks for your helps!
All I tried:I am trying to do by editing the Cgroups, but I can only do this in a container, so may be container should be use in privileged mode.</p>

<p>I expect a resonable plan for this requests.
Thanks...</p>

scofieldmao
<p>The clue is you want to change limits <strong>without killing the pod</strong>. </p>

<p>This is not the way Kubernetes works, as <a href="https://stackoverflow.com/users/1296707/markus-w-mahlberg">Markus W Mahlberg</a> explained in his comment above. In Kubernetes there is no "hot plug CPU/memory" or "live migration" facilities the convenient hypervisors provide. Kubernetes treats pods as ephemeral instances and does not take care about keeping them running. Whether you need to change resource limits for the application, change the app  configuration, install app updates or repair misbehaving application, the <strong>"kill-and-recreate"</strong> approach is applied to pods. </p>

<p>Unfortunately, the solutions suggested here will not work for you: </p>

<ul>
<li>Increasing limits for the running container within the pod ( <code>docker update</code> command ) will lead to breaching the pod limits and killing the pod by Kubernetes. </li>
<li>Vertical Pod Autoscaler is part of Kubernetes project and relies on the "kill-and-recreate" approach as well.</li>
</ul>

<p>If you really need to keep the containers running and managing allocated resource limits for them "on-the-fly", perhaps Kubernetes is not suitable solution in this particular case. Probably you should consider using pure Docker or a VM-based solution. </p>
