<p>I am managing a Kubernetes cluster with 10 nodes(On-prem) and the node's configuration is not identical, 5 nodes are of 64 cores and 125G ram, and 5 nodes are of 64 cores and 256G ram.
Most of the time I keep getting alerts saying the node CPU/MEMORY is high and I see the pods are getting restarted, as it is consuming 92-95% of CPU and memory on certain nodes, I want to apply CPU and Memory Allocation on nodes so that the CPU utilization doesn't go very high.</p>
<p>I tried manually editing the node configuration but that did not work.</p>
<p>Any leads for this will be helpful!</p>

Abhishek Anvekar
<p>In K8s, you can limit the resources usage for the pod containers and reserve a some cpus/memory for the container to avoid this problem:</p>
<pre class="lang-yaml prettyprint-override"><code>---
apiVersion: v1
kind: Pod
metadata:
  name: &lt;pod name&gt;
spec:
  containers:
  - name: c1
    image: ...
    resources:
      requests:
        memory: &quot;64Mi&quot;
        cpu: &quot;250m&quot;
      limits:
        memory: &quot;128Mi&quot;
        cpu: &quot;500m&quot;
  - name: c2
    image: ...
    resources:
      requests:
        memory: &quot;64Mi&quot;
        cpu: &quot;250m&quot;
      limits:
        memory: &quot;128Mi&quot;
        cpu: &quot;500m&quot;
</code></pre>
