<p>I am using YML to create pod and have specified the resource request and limit. Now I am not aware of how to modify the resource limits of a running pod. For example</p>

<p>memory-demo.yml</p>

<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: memory-demo
  namespace: mem-example
spec:
  containers:
  - name: memory-demo-ctr
    image: polinux/stress
    resources:
      limits:
        memory: "200Mi"
      requests:
        memory: "100Mi"
    command: ["stress"]
    args: ["--vm", "1", "--vm-bytes", "150M", "--vm-hang", "1"]
</code></pre>

<p>Then I run the command <code>oc create -f memory-demo.yml</code> and a pod name memory-demo get created. </p>

<p>My Question is what should I do to modify the memory limits from <code>200Mi  --&gt; 600 Mi</code>, Do I need to delete the existing pod and recreate the pod using the modified YML file? </p>

<p>I am a total newbie. Need help.</p>

<p>First and for most, it is very unlikely that you really want to be (re)creating Pods directly. Dig into what <a href="https://kubernetes.io/docs/concepts/workloads/controllers/deployment/" rel="noreferrer">Deployment</a> is and how it works. Then you can simply apply the change to the spec template in deployment and kubernetes will upgrade all the pods in that deployment to match new spec in a hands free rolling update.</p>

<p>Live change of the memory limit for a running container is certainly possible but not by means of kubernetes (and will not be reflected in kube state if you do so). Look at <a href="https://docs.docker.com/engine/reference/commandline/update/" rel="noreferrer">docker update</a>.</p>
