What happens when a visitor opens your app on Kubernetes
Pod IP addresses: why a replaced Kubernetes pod comes back with a new one
You write down the IP address of a Kubernetes pod. For weeks, the address works. Then one day it leads nowhere, and your app never stopped.
-
1
Rono's order app needs the menu for every order. It asks at the address on its note, your pod on node-2, and for weeks that just works.
-
2
Then you ship a new version of your app, with this week's prices. Kubernetes does not change a running pod: it replaces it.
-
3
A part of Kubernetes, a controller, swaps them one at a time: a new pod starts, then an old one stops. This is called a rolling update.
-
4
Your app has 3 pods again, on the same nodes. Each new pod has a new address, and the old addresses left with the old pods.
-
5
Nobody tells the order app. It still sends every request to the address on its note, and no pod has that address now.
-
6
You could fix the note by hand, and the next version would swap all 3 pods again. The order app needs an address that never changes.
-
Quick check
A crash in the night.
Show the answer
No. It is still the same pod, and the address belongs to the pod. Only a new pod gets a new address.
-
Go further
A word for pods that come and go.