Increase memory limit of a running pod
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.
// 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 <your project name>$ oc edit <deployment controller type> <the resource name>:kind: <deployment controller type>metadata: name: <the resource name>spec: : template: : spec: containers: - name: <the container name> resources: limits: // modify the memory size from 2Gi to 4Gi. memory: 4Gi
You have to edit the yaml file and add this resources
section under your containers part
containers:- image: nginx imagePullPolicy: Always name: default-mem-demo-ctr resources: limits: memory: 4Gi #<--------------This is limit requests: memory: 2Gi #<--------------Your applictaion will use memory in between 2Gb to upto 4GB