Tech, ExplainedNetworking, infrastructure and security
Concept

Containers and Kubernetes

Packed once, run on any server.

HOW IT WORKSA developer packsthe app into acontainer imageThe image is stored ina registryKubernetes is toldwhat is wanted:for example, fiverunning copiesKubernetes places thecopies on servers thathave roomIt restarts failedcopies, and adds orremoves copies asdemand changesPacked once, the app runs the same anywhere, andKubernetes keeps the right number of copies running.HOW IT WORKSA developerpacks the appinto acontainerimageThe imageis stored ina registryKubernetes istold what iswanted: forexample, fiverunningcopiesKubernetesplaces thecopies onservers thathave roomIt restartsfailedcopies, andadds orremovescopies asdemandchangesPacked once, the app runs the same anywhere, andKubernetes keeps the right number of copies running.HOW IT WORKSA developer packs the app into acontainer image↓The image is stored in a registry↓Kubernetes is told what is wanted: forexample, five running copies↓Kubernetes places the copies on serversthat have room↓It restarts failed copies, and adds orremoves copies as demand changesPacked once, the app runs the same anywhere, andKubernetes keeps the right number of copies running.
An app is packed into a container image and stored, and Kubernetes places the copies on servers with room, restarts failed ones and adds or removes copies as demand changes.
opens a page inside this one a page in the same scene a page in another scene a concept page a label only, with no page

Containers and Kubernetes are how most modern apps are packaged and run on servers. A container is a packaged piece of an application, together with everything it needs to run: the libraries it uses, its settings and the small parts of an operating system it depends on. Kubernetes is the open-source system that runs containers across many servers. It decides which server runs each container, restarts any container that fails and adds more copies when demand rises. Kubernetes was first built at Google and released free in 2014. It is often written as K8s.

Here is how it works in general. A developer packs the application into a container image, a single file that holds the app and everything it needs. The image is stored in a registry, which is a store for images. Because the image carries its own libraries and settings, it runs the same way on the developer's laptop, on a test server and on the live servers. The developer then tells Kubernetes what is wanted, for example, keep five copies of this container running. Kubernetes places the copies on servers that have room. If a server crashes, Kubernetes starts the lost copies on other servers. If traffic rises, it can add copies, and it removes them when traffic falls.

A modern app is often split into many small services, such as login, search and payments, each running in its own containers. So a team can update one service without stopping the others.

Take, for example, a developer setting up a project on a new laptop. With Docker, she runs the whole app, with its database, in containers, instead of installing each piece by hand.

Consider a shopping app during a festival sale, when the number of visitors rises tenfold in an hour. A Kubernetes platform adds copies of the checkout service, and removes them after the sale.

Say a company wants to answer its customers' questions with an AI model. A model deployment platform packs the model into containers and runs them on Kubernetes, on servers with GPUs.

Containers bring their own security tasks. An image can carry an old library with a known flaw, which container image scanning checks for before release. Once the containers are running, cloud workload protection watches what they do.

How is a container different from a virtual machine? A virtual machine is a whole pretend computer with its own operating system, and it can take a minute or more to start. Containers on one server share that server's operating system, so they are much smaller and start in seconds. Many companies run their containers inside virtual machines in the cloud.

Appears in

Networking, infrastructure and security
Cloud platforms and developer tools
Data platforms and AI
Tech, Explained is a part of ingrid.fyi. Every page explains one piece of technology in plain words.