Resource Requirements

The scheduler determines what node each pod will go to.

If the node doesnt have enough resources, the scheduler will place it on a different node.

If there arent enough resources the pod will not deploy

Resources

CPU

  • Proccessor
  • miliCore
  • 0.5
CPU1.0
AWS vCPU1
GCP Core1
Azure Core1
Hyperthread1

MEM

  • Memory
  • bytes
  • "256Mi" or "1G"

Disk

  • Storgae
  • bytes Gi, Mi
  • "1Gi"

Set Pod Resource Limits And Requests

 1apiVersion: 
 2kind: Pod
 3metadata:
 4  name: simple-webapp-color
 5spec:
 6  containers:
 7    - name: simple-webapp-color
 8      image: simple-webapp-color
 9      ports:
10        - containerPort: 8080
11      env:
12        - name: APP_COLOR
13          valueFrom:
14            name: app-config
15            key: APP_COLOR
16      
17      resources:
18        requests:
19          memory: "256Mi"
20          cpu: 0.5  
21        limits:
22          memory: "512Mi"
23          cpu: 1
24        

If a pod tries to exceed the limits, k8s will throttle the pod. The Memory does not throttle and it will just terminate the pod if it runs out of MEM