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: why one server is not enough to keep an app online

What happens when you run kubectl apply

Image and container: what Kubernetes actually copies

Kubernetes runs copies of an app on many servers at the same time. But if you copy only the code to a server, the app fails at once. So what does Kubernetes really copy?

  1. 1 Copy only your app to a server, and it fails at once. The program that runs its language, such as Python, and its dependencies, the packages of code it uses, stayed on your laptop.your laptopa serverWhere are mydependencies?

    Copy only your app to a server, and it fails at once. The program that runs its language, such as Python, and its dependencies, the packages of code it uses, stayed on your laptop.

  2. 2 So you pack your app and everything it needs into one sealed package, called an image.imageyour appdependenciesPython

    So you pack your app and everything it needs into one sealed package, called an image.

  3. 3 An image runs nothing by itself. A server has to start your app from it, and each running copy of the image is a container.imagecontainerEverything Ineed is in here.

    An image runs nothing by itself. A server has to start your app from it, and each running copy of the image is a container.

  4. 4 That answers Kubernetes: the 3 copies are 3 containers, all started from the same image.Kubernetes3 containers,one image!image

    That answers Kubernetes: the 3 copies are 3 containers, all started from the same image.

  5. 5 But the image sits on your laptop, out of reach of the servers. So you send it to a registry, a store of images that servers fetch from.registryimageyour laptopservers

    But the image sits on your laptop, out of reach of the servers. So you send it to a registry, a store of images that servers fetch from.

  6. 6 Not yet. An image on a shelf runs nothing, and Kubernetes has not picked a server for any container.RonoIs the menuonline now?registryimage

    Not yet. An image on a shelf runs nothing, and Kubernetes has not picked a server for any container.

  7. Quick check

    You fix a typo in the menu, on your laptop.The 3 containerskeep running.Do they showthe fix?

    You fix a typo in the menu, on your laptop.

    Show the answer

    No. They run the image as you packed it. The fix needs a new image, and new containers started from it.

  8. Go further

    Two names you will meet around images.imagecontainer imagethe full nameof an image1.0tagthe version of animage, writtenafter its name:cafe-menu:1.0

    Two names you will meet around images.

Next episode Kubernetes cluster: the control plane decides, the nodes run your app

Share this comic

More comics