DEV Community

Cheedge Lee
Cheedge Lee

Posted on

CKA Recap - Pod Schedual

This is a quick recap for the points of pod schedual, details can click each title link or the final reference.

1. Affinity

  • nodeAffinity and nodeAntiAffinity
    • node labels
  • podAffinity and podAntiAffinity
    • pod labels
  • requiredDuringSchedulingIgnoredDuringExecution and preferredDuringSchedulingIgnoredDuringExecution
  • topologyKey

2. nodeName/nodeSelector

spec:
  containers:
  - name: nginx
    image: nginx
    imagePullPolicy: IfNotPresent
  nodeSelector:
    disktype: ssd
---
spec:
  nodeName: foo-node # schedule pod to specific node
  containers:
  - name: nginx
    image: nginx
    imagePullPolicy: IfNotPresent
Enter fullscreen mode Exit fullscreen mode

3. Taint/Tolerations

CMD

k taint node NAME key[:value]:[EFFECT]
k describe node NAME | grep -i taint
Enter fullscreen mode Exit fullscreen mode

yaml

tolerations:
- key: "example-key"
  operator: "Exists"
  effect: "NoSchedule"
- key: "key1"
  operator: "Equal"
  value: "value1"
  effect: "NoExecute"
Enter fullscreen mode Exit fullscreen mode

4. Priority

The larger the higher

priorityclass

k get priorityclass
Enter fullscreen mode Exit fullscreen mode

yaml

spec:
  containers:
  - name: nginx
    image: nginx
    imagePullPolicy: IfNotPresent
  priorityClassName: high-priority
Enter fullscreen mode Exit fullscreen mode

Reference

Different way to assign Pods to Nodes
Assign Pods to Nodes
Pod Priority and Preemption

Top comments (0)