tezvyn:

Spreading Pods one-per-node for availability

Source: interviewadvanced

WHAT IT TESTS: Pod anti-affinity knowledge. OUTLINE: Use required podAntiAffinity with topologyKey kubernetes.io/hostname matching the Deployment's own pod labels, so the scheduler refuses to co-locate two Pods on a node.

WHAT IT TESTS: Whether you reach for the correct scheduling primitive. ANSWER OUTLINE: Add a podAntiAffinity rule under affinity in the Pod template, using requiredDuringSchedulingIgnoredDuringExecution with a labelSelector matching the Deployment's own Pod labels and topologyKey kubernetes.io/hostname. This tells the scheduler that two Pods sharing those labels must not land in the same hostname topology. Note that with N replicas you need at least N nodes or some Pods stay Pending.

Read the original → interview

Get five bites like this every day.

Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.

Spreading Pods one-per-node for availability · Tezvyn