<p>I have a pod running in openshift 3.11, I wish to increase the pod memory limit from 2GB to 4GB. How to do it via Openshift Web Console or via OC command line?</p>
<p>When I try to edit the yaml file in Openshift Web Console  I got the following exception</p>
<blockquote>
<p>Reason: Pod &quot;hjaha&quot; is invalid: spec: Forbidden: pod updates may not
change fields other than <code>spec.containers[*].image</code>,
<code>spec.initContainers[*].image</code>, <code>spec.activeDeadlineSeconds</code> or
<code>spec.tolerations</code> (only additions to existing tolerations)...</p>
</blockquote>

<p>Basically Pods are deployed using containers template of the controllers of the Pods, such as DeploymentConfig, Deployment, DaemonSet, StatefulSet and so on. First of all, you should verify what controller is used for your Pod deployment and modify the resources section on the controller yaml, not running Pod yaml. Look at the following example, if you modify the memory limit on the deployment controller yaml using oc CLI or web console, then it will deploy new pod with new configuration after that.</p>
<pre><code>// List some deployment controller resources as follows.
// Then you can see one which is similar name with running pod name.
$ oc get deploymentconfig,deployment,statefulset,daemonset -n &lt;your project name&gt;

$ oc edit &lt;deployment controller type&gt; &lt;the resource name&gt;
:
kind: &lt;deployment controller type&gt;
metadata:
  name: &lt;the resource name&gt;
spec:
  :
  template:
    :
    spec:
      containers:
        - name: &lt;the container name&gt;
          resources:
            limits:
              // modify the memory size from 2Gi to 4Gi.
              memory: 4Gi
</code></pre>
