You are signed in. Close

You are signed out. Close

Thank you. Your subscription has started. Close

Thank you. You will get an email when a new comic comes out. Close

We could not confirm your payment. If you paid, use the link "Sign in" at the bottom of the page. Close

Something went wrong on our side. Please try again in a moment. Close

Previous episode Kubernetes pod IP addresses: why your app runs and no visitor can open it

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. 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.order appcafe-menu:10.244.2.4Same address,every time.

    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. 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.youVersion 2:this week's prices.node-1node-2node-3node-4otherapps

    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. 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.controllerOne at a time:a new pod in,then an old one out.node-1node-2node-3node-4otherappstop: newbottom: old

    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. 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.new pods10.244.1.510.244.1.410.244.2.510.244.2.410.244.3.510.244.3.4old addresses

    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. 5 Nobody tells the order app. It still sends every request to the address on its note, and no pod has that address now.node-1node-2node-3node-4otherappsTo: 10.244.2.4?Hello?Anyone?

    Nobody tells the order app. It still sends every request to the address on its note, and no pod has that address now.

  6. 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.youcafe-menu:10.244.2.410.244.2.5next version???

    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.

  7. Quick check

    A crash in the night.A container crashes,and Kubernetes startsit again inside thesame pod. Does thatpod get a new address?

    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.

  8. Go further

    A word for pods that come and go.ephemeralwhat pods are: made to bethrown away and replaced,never moved

    A word for pods that come and go.

Next episode Kubernetes Service: one address that stays while pods come and go

Share this comic

More comics