Kubernetes for Beginners / Chapter 1 — The cluster and the Pod (lessons 1–3) / Lesson 1

What Kubernetes is

Time needed: about 6 min (estimate)

☆ Read later

You can try the opening of this lesson without an account.

What docker compose up does not answer

Once you can run containers with Docker, the next situations arrive.

Who restarts a container when it dies?

How many copies do you run when traffic grows?

How do you swap in a new version without stopping? docker compose up answers none of them.

Kubernetes is the tool for the keep-it-running side of the problem.

The difference shows up in the shape of what you write.

Compose and Kubernetes

# Docker Compose: writes what to do (imperative) docker compose up -d docker compose scale web=3 # Kubernetes: writes the desired state (declarative) spec: replicas: 3

replicas: 3 is not a command but a declaration of state.

Kubernetes keeps watching how many are running right now, and whenever that is not three it works to make it three.

If a Pod dies it is recreated; if a node dies it is recreated on another node.

Things recover even though nobody issued an order — that is this mechanism at work.

Here is what it takes off your hands.

Create a free account to keep reading

With an account you can read the rest of this lesson, take the quiz, and read every free lesson in this course. Lessons you answer correctly are recorded as complete.

Report a problem with this lesson

Log in to send a report.

Keyboard shortcuts

Keys available in a lesson
KeyAction
[ or Alt + ←Go to the previous lesson
] or Alt + →Go to the next lesson
?Open this list
EscClose this list

The keys do not work while the cursor is in a code editor or an input field.