Machine Room

Kubernetes

The desired state, the parts, and one fix for a crash, a traffic spike and a dead machine. The one-page notes from the reel.

Download the PDF

One-page notes on Kubernetes. You say what you want, Kubernetes keeps making it true. 1, the desired state: a card with replicas: 3, a loop arrow around an equals sign, and a running box with three copies of the app; replicas: 3 = running 3 means nothing to do, replicas: 3 ≠ running 2 means fix it. You don't give Kubernetes step-by-step orders; you write down what you want, the desired state, and Kubernetes keeps comparing it with what's actually running and fixes any difference on its own. 2, what's in a container: your code, Node.js runtime, npm packages, system libraries, settings; usually built with Docker, it behaves the same on any machine. 3, the parts: node = one machine, for example an EC2 instance on AWS; cluster = the whole group of nodes; control plane = the part that does the comparing and decides which copy runs on which machine. 4, one fix for everything, as a table of desired and running: a copy crashes, 3 and 2, restarts it on the same machine; load goes up, 3 to 10 and 3, the autoscaler raises the number and Kubernetes starts 7 more; load drops, 10 to 3 and 10, the autoscaler lowers it and Kubernetes removes the extra 7; a machine dies, 3 and 1, starts new copies on the other machines. 5, whose job is it on AWS: Kubernetes handles the copies (restart, add, remove, replace); AWS handles the machines (a machine dies: the Auto Scaling group launches a new one and it joins the cluster; copies run out of room: the node autoscaler asks AWS for one more machine). 6, the real names: copy of your app = Pod, the autoscaler = HorizontalPodAutoscaler, node autoscaler = Cluster Autoscaler. A crash, a traffic spike and a dead machine are the same fix: make running match desired.

On a phone, press and hold the image to save it. The reel: What Is Kubernetes? How It Works in 2 Minutes.