Kubernetes Simulator

advanced · ~15 min

All on one

Ticket from Tom Okafor, product manager

Launch is tomorrow. After last week's node reboot, all four web pods ended up on hackademy-worker, and Dana says one more reboot there takes the whole site down.

I need web spread evenly over the two workers, and kept that way whenever pods are replaced. web.yaml is the manifest.

Topology spread constraints

Keep matching pods evenly over domains, such as nodes (kubernetes.io/hostname) or zones. maxSkew is the most one domain may exceed the emptiest. By default every node with the key counts as a domain, tainted ones included; nodeTaintsPolicy: Honor leaves out nodes the pod can't tolerate. Docs

Objectives

  • web: 4 ready replicas
  • Two on each worker
  • web's template keeps them even with a topology spread constraint
  • Bonus: Keep the spread a hard rule (DoNotSchedule), not a preference

Best on a computer with a keyboard. It works on a phone, with shortcuts under the terminal.