InterviewSolution
Saved Bookmarks
| 1. |
What is node affinity and pod affinity? |
Answer»
Pod Affinity ensures TWO pods to be co-located in a SINGLE node. Node Affinity apiVersion: v1 kind: Pod metadata: name: with-node-affinity spec: affinity: nodeAffinity: requiredDuringSchedulingIgnoredDuringExecution: nodeSelectorTerms: - matchExpressions: - key: Kubernetes.io/e2e-az-name operator: In values: - e2e-az1Pod Affinity apiVersion: v1 kind: Pod metadata: name: with-pod-affinity spec: affinity: podAffinity: requiredDuringSchedulingIgnoredDuringExecution: - labelSelector: matchExpressions: - key: security operator: In values: - S1The pod affinity rule SAYS that the pod can be scheduled to a node only if that node is in the same zone as at least one already-running pod that has a label with key “security” and VALUE “S1” Reference: https://Kubernetes.io/docs/concepts/configuration/assign-pod-node/ |
|