Docker vs Kubernetes: What's the Difference?
Docker vs Kubernetes, shown on a real lab instead of slides: the same small web app run by Docker alone on one server, then by Kubernetes on a three-machine cluster. What each does when the app crashes, when version 2 goes out, and when a whole machine is switched off, what Kubernetes costs, and which one to pick.

Switch one machine off
Your app runs in Docker. Do you need Kubernetes? Let's switch off a machine. Docker alone: down. Kubernetes: a few misses, then it answers.

The short answer: Docker runs your app in a box, on one machine. Kubernetes keeps those boxes running across many. Docker isn't broken. It just knows one machine.
Docker: your app in a box
Let's find that one-machine limit. On server1, your app is two files: app.py, a small web server, and the Dockerfile, its recipe.
lsDockerfile app.py
Four lines: start from Python, work in a folder called app, copy your app in, and run it with Python.
cat DockerfileFROM python:3.13-slim WORKDIR /app COPY app.py . CMD ["python", "app.py"]
docker build follows that recipe and makes an image: your app plus everything it needs to run, packed together, and named myapp, version 1.0.
docker build -t myapp:1.0 .[+] Building 0.0s (0/1) docker:default [+] Building 0.2s (1/2) docker:default => [internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 111B 0.0s => [internal] load metadata for docker.io/library/python:3.13-slim 0.2s [+] Building 0.3s (1/2) docker:default => [internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 111B 0.0s => [internal] load metadata for docker.io/library/python:3.13-slim 0.3s [+] Building 0.5s (1/2) docker:default => [internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 111B 0.0s => [internal] load metadata for docker.io/library/python:3.13-slim 0.5s [+] Building 0.6s (1/2) docker:default => [internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 111B 0.0s => [internal] load metadata for docker.io/library/python:3.13-slim 0.6s [+] Building 0.8s (1/2) docker:default => [internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 111B 0.0s => [internal] load metadata for docker.io/library/python:3.13-slim 0.8s [+] Building 0.8s (2/2) docker:default => [internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 111B 0.0s => [internal] load metadata for docker.io/library/python:3.13-slim 0.8s [+] Building 1.0s (4/7) docker:default => [internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 111B 0.0s => [internal] load metadata for docker.io/library/python:3.13-slim 0.8s => [internal] load .dockerignore 0.0s => => transferring context: 2B 0.0s => [1/3] FROM docker.io/library/python:3.13-slim@sha256:168d3a5d10f2152f8e8d77b6843ac82c22a8 0.2s => => resolve docker.io/library/python:3.13-slim@sha256:168d3a5d10f2152f8e8d77b6843ac82c22a8 0.0s => => sha256:5a68082d8c2a89d359aeceb86b41906db17bb84f454d9ea6af2ae3e011d30b85 246B / 246B 0.0s => => sha256:cda0d73a344742ea41760acd07d884d384ede45b49e9efc24569acc6006a15eb 0B / 11.86MB 0.2s => [internal] load build context 0.0s => => transferring context: 1.21kB 0.0s [+] Building 1.2s (4/7) docker:default => [internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 111B 0.0s => [internal] load metadata for docker.io/library/python:3.13-slim 0.8s => [internal] load .dockerignore 0.0s => => transferring context: 2B 0.0s => [1/3] FROM docker.io/library/python:3.13-slim@sha256:168d3a5d10f2152f8e8d77b6843ac82c22a8 0.3s => => resolve docker.io/library/python:3.13-slim@sha256:168d3a5d10f2152f8e8d77b6843ac82c22a8 0.0s => => sha256:5a68082d8c2a89d359aeceb86b41906db17bb84f454d9ea6af2ae3e011d30b85 246B / 246B 0.0s => => sha256:cda0d73a344742ea41760acd07d884d384ede45b49e9efc24569acc6006a15eb 0B / 11.86MB 0.3s => => sha256:374d74f3f7088077af53ff5725d7942c1f65ebe6eeb72161bbd37954fb861ee0 0B / 1.27MB 0.3s => => sha256:48fb00926fe468d83ca04ee6775f36350d17e0f328dfcb03aadb5de0c52ae3f6 0B / 30.20MB 0.3s => [internal] load build context 0.0s => => transferring context: 1.21kB 0.0s [+] Building 1.2s (4/7) docker:default => [internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 111B 0.0s => [internal] load metadata for docker.io/library/python:3.13-slim 0.8s => [internal] load .dockerignore 0.0s => => transferring context: 2B 0.0s => [1/3] FROM docker.io/library/python:3.13-slim@sha256:168d3a5d10f2152f8e8d77b6843ac82c22a8 0.3s => => resolve docker.io/library/python:3.13-slim@sha256:168d3a5d10f2152f8e8d77b6843ac82c22a8 0.0s => => sha256:5a68082d8c2a89d359aeceb86b41906db17bb84f454d9ea6af2ae3e011d30b85 246B / 246B 0.0s => => sha256:cda0d73a344742ea41760acd07d884d384ede45b49e9efc24569acc6006a15eb 0B / 11.86MB 0.3s => => sha256:374d74f3f7088077af53ff5725d7942c1f65ebe6eeb72161bbd37954fb861ee0 0B / 1.27MB 0.3s => => sha256:48fb00926fe468d83ca04ee6775f36350d17e0f328dfcb03aadb5de0c52ae3f6 0B / 30.20MB 0.3s => [internal] load build context 0.0s => => transferring context: 1.21kB 0.0s [+] Building 1.3s (4/7) docker:default => [internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 111B 0.0s => [internal] load metadata for docker.io/library/python:3.13-slim 0.8s => [internal] load .dockerignore 0.0s => => transferring context: 2B 0.0s => [1/3] FROM docker.io/library/python:3.13-slim@sha256:168d3a5d10f2152f8e8d77b6843ac82c22a8 0.5s => => resolve docker.io/library/python:3.13-slim@sha256:168d3a5d10f2152f8e8d77b6843ac82c22a8 0.0s => => sha256:5a68082d8c2a89d359aeceb86b41906db17bb84f454d9ea6af2ae3e011d30b85 246B / 246B 0.0s => => sha256:cda0d73a344742ea41760acd07d884d384ede45b49e9efc24569acc6006a15 2.10MB / 11.86MB 0.5s => => sha256:374d74f3f7088077af53ff5725d7942c1f65ebe6eeb72161bbd37954fb861ee0 0B / 1.27MB 0.4s => => sha256:48fb00926fe468d83ca04ee6775f36350d17e0f328dfcb03aadb5de0c52ae3f6 0B / 30.20MB 0.4s => [internal] load build context 0.0s => => transferring context: 1.21kB 0.0s [+] Building 1.5s (4/7) docker:default => [internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 111B 0.0s => [internal] load metadata for docker.io/library/python:3.13-slim 0.8s => [internal] load .dockerignore 0.0s => => transferring context: 2B 0.0s => [1/3] FROM docker.io/library/python:3.13-slim@sha256:168d3a5d10f2152f8e8d77b6843ac82c22a8 0.6s => => resolve docker.io/library/python:3.13-slim@sha256:168d3a5d10f2152f8e8d77b6843ac82c22a8 0.0s => => sha256:5a68082d8c2a89d359aeceb86b41906db17bb84f454d9ea6af2ae3e011d30b85 246B / 246B 0.0s => => sha256:cda0d73a344742ea41760acd07d884d384ede45b49e9efc24569acc6006a15 4.19MB / 11.86MB 0.6s => => sha256:374d74f3f7088077af53ff5725d7942c1f65ebe6eeb72161bbd37954fb861ee 1.27MB / 1.27MB 0.5s => => sha256:48fb00926fe468d83ca04ee6775f36350d17e0f328dfcb03aadb5de0c52ae3f6 0B / 30.20MB 0.6s => [internal] load build context 0.0s => => transferring context: 1.21kB 0.0s [+] Building 1.6s (4/7) docker:default => [internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 111B 0.0s => [internal] load metadata for docker.io/library/python:3.13-slim 0.8s => [internal] load .dockerignore 0.0s => => transferring context: 2B 0.0s => [1/3] FROM docker.io/library/python:3.13-slim@sha256:168d3a5d10f2152f8e8d77b6843ac82c22a8 0.8s => => resolve docker.io/library/python:3.13-slim@sha256:168d3a5d10f2152f8e8d77b6843ac82c22a8 0.0s => => sha256:5a68082d8c2a89d359aeceb86b41906db17bb84f454d9ea6af2ae3e011d30b85 246B / 246B 0.0s => => sha256:cda0d73a344742ea41760acd07d884d384ede45b49e9efc24569acc6006a15 6.29MB / 11.86MB 0.8s => => sha256:374d74f3f7088077af53ff5725d7942c1f65ebe6eeb72161bbd37954fb861ee 1.27MB / 1.27MB 0.5s => => sha256:48fb00926fe468d83ca04ee6775f36350d17e0f328dfcb03aadb5de0c52ae3 1.05MB / 30.20MB 0.7s => [internal] load build context 0.0s => => transferring context: 1.21kB 0.0s [+] Building 1.8s (4/7) docker:default => [internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 111B 0.0s => [internal] load metadata for docker.io/library/python:3.13-slim 0.8s => [internal] load .dockerignore 0.0s => => transferring context: 2B 0.0s => [1/3] FROM docker.io/library/python:3.13-slim@sha256:168d3a5d10f2152f8e8d77b6843ac82c22a8 0.9s => => resolve docker.io/library/python:3.13-slim@sha256:168d3a5d10f2152f8e8d77b6843ac82c22a8 0.0s => => sha256:5a68082d8c2a89d359aeceb86b41906db17bb84f454d9ea6af2ae3e011d30b85 246B / 246B 0.0s => => sha256:cda0d73a344742ea41760acd07d884d384ede45b49e9efc24569acc6006a15 7.34MB / 11.86MB 0.9s => => sha256:374d74f3f7088077af53ff5725d7942c1f65ebe6eeb72161bbd37954fb861ee 1.27MB / 1.27MB 0.5s => => sha256:48fb00926fe468d83ca04ee6775f36350d17e0f328dfcb03aadb5de0c52ae3 1.05MB / 30.20MB 0.9s => [internal] load build context 0.0s => => transferring context: 1.21kB 0.0s [+] Building 1.9s (4/7) docker:default => [internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 111B 0.0s => [internal] load metadata for docker.io/library/python:3.13-slim 0.8s => [internal] load .dockerignore 0.0s => => transferring context: 2B 0.0s => [1/3] FROM docker.io/library/python:3.13-slim@sha256:168d3a5d10f2152f8e8d77b6843ac82c22a8 1.1s => => resolve docker.io/library/python:3.13-slim@sha256:168d3a5d10f2152f8e8d77b6843ac82c22a8 0.0s => => sha256:5a68082d8c2a89d359aeceb86b41906db17bb84f454d9ea6af2ae3e011d30b85 246B / 246B 0.0s => => sha256:cda0d73a344742ea41760acd07d884d384ede45b49e9efc24569acc6006a1 11.86MB / 11.86MB 1.1s => => sha256:374d74f3f7088077af53ff5725d7942c1f65ebe6eeb72161bbd37954fb861ee 1.27MB / 1.27MB 0.5s => => sha256:48fb00926fe468d83ca04ee6775f36350d17e0f328dfcb03aadb5de0c52ae3 2.10MB / 30.20MB 1.0s => [internal] load build context 0.0s => => transferring context: 1.21kB 0.0s [+] Building 2.1s (4/7) docker:default => [internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 111B 0.0s => [internal] load metadata for docker.io/library/python:3.13-slim 0.8s => [internal] load .dockerignore 0.0s => => transferring context: 2B 0.0s => [1/3] FROM docker.io/library/python:3.13-slim@sha256:168d3a5d10f2152f8e8d77b6843ac82c22a8 1.2s => => resolve docker.io/library/python:3.13-slim@sha256:168d3a5d10f2152f8e8d77b6843ac82c22a8 0.0s => => sha256:5a68082d8c2a89d359aeceb86b41906db17bb84f454d9ea6af2ae3e011d30b85 246B / 246B 0.0s => => sha256:cda0d73a344742ea41760acd07d884d384ede45b49e9efc24569acc6006a1 11.86MB / 11.86MB 1.1s => => sha256:374d74f3f7088077af53ff5725d7942c1f65ebe6eeb72161bbd37954fb861ee 1.27MB / 1.27MB 0.5s => => sha256:48fb00926fe468d83ca04ee6775f36350d17e0f328dfcb03aadb5de0c52ae3 4.19MB / 30.20MB 1.2s => [internal] load build context 0.0s => => transferring context: 1.21kB 0.0s [+] Building 2.2s (4/7) docker:default => [internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 111B 0.0s => [internal] load metadata for docker.io/library/python:3.13-slim 0.8s => [internal] load .dockerignore 0.0s => => transferring context: 2B 0.0s => [1/3] FROM docker.io/library/python:3.13-slim@sha256:168d3a5d10f2152f8e8d77b6843ac82c22a8 1.4s => => resolve docker.io/library/python:3.13-slim@sha256:168d3a5d10f2152f8e8d77b6843ac82c22a8 0.0s => => sha256:5a68082d8c2a89d359aeceb86b41906db17bb84f454d9ea6af2ae3e011d30b85 246B / 246B 0.0s => => sha256:cda0d73a344742ea41760acd07d884d384ede45b49e9efc24569acc6006a1 11.86MB / 11.86MB 1.1s => => sha256:374d74f3f7088077af53ff5725d7942c1f65ebe6eeb72161bbd37954fb861ee 1.27MB / 1.27MB 0.5s => => sha256:48fb00926fe468d83ca04ee6775f36350d17e0f328dfcb03aadb5de0c52ae3 4.19MB / 30.20MB 1.4s => [internal] load build context 0.0s => => transferring context: 1.21kB 0.0s [+] Building 2.2s (4/7) docker:default => [internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 111B 0.0s => [internal] load metadata for docker.io/library/python:3.13-slim 0.8s => [internal] load .dockerignore 0.0s => => transferring context: 2B 0.0s => [1/3] FROM docker.io/library/python:3.13-slim@sha256:168d3a5d10f2152f8e8d77b6843ac82c22a8 1.4s => => resolve docker.io/library/python:3.13-slim@sha256:168d3a5d10f2152f8e8d77b6843ac82c22a8 0.0s => => sha256:5a68082d8c2a89d359aeceb86b41906db17bb84f454d9ea6af2ae3e011d30b85 246B / 246B 0.0s => => sha256:cda0d73a344742ea41760acd07d884d384ede45b49e9efc24569acc6006a1 11.86MB / 11.86MB 1.1s => => sha256:374d74f3f7088077af53ff5725d7942c1f65ebe6eeb72161bbd37954fb861ee 1.27MB / 1.27MB 0.5s => => sha256:48fb00926fe468d83ca04ee6775f36350d17e0f328dfcb03aadb5de0c52ae3 6.29MB / 30.20MB 1.4s => [internal] load build context 0.0s => => transferring context: 1.21kB 0.0s [+] Building 2.4s (4/7) docker:default => [internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 111B 0.0s => [internal] load metadata for docker.io/library/python:3.13-slim 0.8s => [internal] load .dockerignore 0.0s => => transferring context: 2B 0.0s => [1/3] FROM docker.io/library/python:3.13-slim@sha256:168d3a5d10f2152f8e8d77b6843ac82c22a8 1.5s => => resolve docker.io/library/python:3.13-slim@sha256:168d3a5d10f2152f8e8d77b6843ac82c22a8 0.0s => => sha256:5a68082d8c2a89d359aeceb86b41906db17bb84f454d9ea6af2ae3e011d30b85 246B / 246B 0.0s => => sha256:cda0d73a344742ea41760acd07d884d384ede45b49e9efc24569acc6006a1 11.86MB / 11.86MB 1.1s => => sha256:374d74f3f7088077af53ff5725d7942c1f65ebe6eeb72161bbd37954fb861ee 1.27MB / 1.27MB 0.5s => => sha256:48fb00926fe468d83ca04ee6775f36350d17e0f328dfcb03aadb5de0c52ae3 8.39MB / 30.20MB 1.5s => [internal] load build context 0.0s => => transferring context: 1.21kB 0.0s [+] Building 2.5s (4/7) docker:default => [internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 111B 0.0s => [internal] load metadata for docker.io/library/python:3.13-slim 0.8s => [internal] load .dockerignore 0.0s => => transferring context: 2B 0.0s => [1/3] FROM docker.io/library/python:3.13-slim@sha256:168d3a5d10f2152f8e8d77b6843ac82c22a8 1.7s => => resolve docker.io/library/python:3.13-slim@sha256:168d3a5d10f2152f8e8d77b6843ac82c22a8 0.0s => => sha256:5a68082d8c2a89d359aeceb86b41906db17bb84f454d9ea6af2ae3e011d30b85 246B / 246B 0.0s => => sha256:cda0d73a344742ea41760acd07d884d384ede45b49e9efc24569acc6006a1 11.86MB / 11.86MB 1.1s => => sha256:374d74f3f7088077af53ff5725d7942c1f65ebe6eeb72161bbd37954fb861ee 1.27MB / 1.27MB 0.5s => => sha256:48fb00926fe468d83ca04ee6775f36350d17e0f328dfcb03aadb5de0c52ae 11.53MB / 30.20MB 1.7s => [internal] load build context 0.0s => => transferring context: 1.21kB 0.0s [+] Building 2.7s (4/7) docker:default => [internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 111B 0.0s => [internal] load metadata for docker.io/library/python:3.13-slim 0.8s => [internal] load .dockerignore 0.0s => => transferring context: 2B 0.0s => [1/3] FROM docker.io/library/python:3.13-slim@sha256:168d3a5d10f2152f8e8d77b6843ac82c22a8 1.8s => => resolve docker.io/library/python:3.13-slim@sha256:168d3a5d10f2152f8e8d77b6843ac82c22a8 0.0s => => sha256:5a68082d8c2a89d359aeceb86b41906db17bb84f454d9ea6af2ae3e011d30b85 246B / 246B 0.0s => => sha256:cda0d73a344742ea41760acd07d884d384ede45b49e9efc24569acc6006a1 11.86MB / 11.86MB 1.1s => => sha256:374d74f3f7088077af53ff5725d7942c1f65ebe6eeb72161bbd37954fb861ee 1.27MB / 1.27MB 0.5s => => sha256:48fb00926fe468d83ca04ee6775f36350d17e0f328dfcb03aadb5de0c52ae 11.53MB / 30.20MB 1.8s => [internal] load build context 0.0s => => transferring context: 1.21kB 0.0s [+] Building 2.7s (4/7) docker:default => [internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 111B 0.0s => [internal] load metadata for docker.io/library/python:3.13-slim 0.8s => [internal] load .dockerignore 0.0s => => transferring context: 2B 0.0s => [1/3] FROM docker.io/library/python:3.13-slim@sha256:168d3a5d10f2152f8e8d77b6843ac82c22a8 1.8s => => resolve docker.io/library/python:3.13-slim@sha256:168d3a5d10f2152f8e8d77b6843ac82c22a8 0.0s => => sha256:5a68082d8c2a89d359aeceb86b41906db17bb84f454d9ea6af2ae3e011d30b85 246B / 246B 0.0s => => sha256:cda0d73a344742ea41760acd07d884d384ede45b49e9efc24569acc6006a1 11.86MB / 11.86MB 1.1s => => sha256:374d74f3f7088077af53ff5725d7942c1f65ebe6eeb72161bbd37954fb861ee 1.27MB / 1.27MB 0.5s => => sha256:48fb00926fe468d83ca04ee6775f36350d17e0f328dfcb03aadb5de0c52ae 16.78MB / 30.20MB 1.8s => [internal] load build context 0.0s => => transferring context: 1.21kB 0.0s [+] Building 2.8s (4/7) docker:default => [internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 111B 0.0s => [internal] load metadata for docker.io/library/python:3.13-slim 0.8s => [internal] load .dockerignore 0.0s => => transferring context: 2B 0.0s => [1/3] FROM docker.io/library/python:3.13-slim@sha256:168d3a5d10f2152f8e8d77b6843ac82c22a8 2.0s => => resolve docker.io/library/python:3.13-slim@sha256:168d3a5d10f2152f8e8d77b6843ac82c22a8 0.0s => => sha256:5a68082d8c2a89d359aeceb86b41906db17bb84f454d9ea6af2ae3e011d30b85 246B / 246B 0.0s => => sha256:cda0d73a344742ea41760acd07d884d384ede45b49e9efc24569acc6006a1 11.86MB / 11.86MB 1.1s => => sha256:374d74f3f7088077af53ff5725d7942c1f65ebe6eeb72161bbd37954fb861ee 1.27MB / 1.27MB 0.5s => => sha256:48fb00926fe468d83ca04ee6775f36350d17e0f328dfcb03aadb5de0c52ae 16.78MB / 30.20MB 2.0s => [internal] load build context 0.0s => => transferring context: 1.21kB 0.0s [+] Building 2.8s (4/7) docker:default => [internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 111B 0.0s => [internal] load metadata for docker.io/library/python:3.13-slim 0.8s => [internal] load .dockerignore 0.0s => => transferring context: 2B 0.0s => [1/3] FROM docker.io/library/python:3.13-slim@sha256:168d3a5d10f2152f8e8d77b6843ac82c22a8 2.0s => => resolve docker.io/library/python:3.13-slim@sha256:168d3a5d10f2152f8e8d77b6843ac82c22a8 0.0s => => sha256:5a68082d8c2a89d359aeceb86b41906db17bb84f454d9ea6af2ae3e011d30b85 246B / 246B 0.0s => => sha256:cda0d73a344742ea41760acd07d884d384ede45b49e9efc24569acc6006a1 11.86MB / 11.86MB 1.1s => => sha256:374d74f3f7088077af53ff5725d7942c1f65ebe6eeb72161bbd37954fb861ee 1.27MB / 1.27MB 0.5s => => sha256:48fb00926fe468d83ca04ee6775f36350d17e0f328dfcb03aadb5de0c52ae 18.87MB / 30.20MB 2.0s => [internal] load build context 0.0s => => transferring context: 1.21kB 0.0s [+] Building 3.0s (4/7) docker:default => [internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 111B 0.0s => [internal] load metadata for docker.io/library/python:3.13-slim 0.8s => [internal] load .dockerignore 0.0s => => transferring context: 2B 0.0s => [1/3] FROM docker.io/library/python:3.13-slim@sha256:168d3a5d10f2152f8e8d77b6843ac82c22a8 2.1s => => resolve docker.io/library/python:3.13-slim@sha256:168d3a5d10f2152f8e8d77b6843ac82c22a8 0.0s => => sha256:5a68082d8c2a89d359aeceb86b41906db17bb84f454d9ea6af2ae3e011d30b85 246B / 246B 0.0s => => sha256:cda0d73a344742ea41760acd07d884d384ede45b49e9efc24569acc6006a1 11.86MB / 11.86MB 1.1s => => sha256:374d74f3f7088077af53ff5725d7942c1f65ebe6eeb72161bbd37954fb861ee 1.27MB / 1.27MB 0.5s => => sha256:48fb00926fe468d83ca04ee6775f36350d17e0f328dfcb03aadb5de0c52ae 25.17MB / 30.20MB 2.1s => [internal] load build context 0.0s => => transferring context: 1.21kB 0.0s [+] Building 3.2s (4/7) docker:default => [internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 111B 0.0s => [internal] load metadata for docker.io/library/python:3.13-slim 0.8s => [internal] load .dockerignore 0.0s => => transferring context: 2B 0.0s => [1/3] FROM docker.io/library/python:3.13-slim@sha256:168d3a5d10f2152f8e8d77b6843ac82c22a8 2.4s => => resolve docker.io/library/python:3.13-slim@sha256:168d3a5d10f2152f8e8d77b6843ac82c22a8 0.0s => => sha256:5a68082d8c2a89d359aeceb86b41906db17bb84f454d9ea6af2ae3e011d30b85 246B / 246B 0.0s => => sha256:cda0d73a344742ea41760acd07d884d384ede45b49e9efc24569acc6006a1 11.86MB / 11.86MB 1.1s => => sha256:374d74f3f7088077af53ff5725d7942c1f65ebe6eeb72161bbd37954fb861ee 1.27MB / 1.27MB 0.5s => => sha256:48fb00926fe468d83ca04ee6775f36350d17e0f328dfcb03aadb5de0c52ae 30.20MB / 30.20MB 2.2s => => extracting sha256:48fb00926fe468d83ca04ee6775f36350d17e0f328dfcb03aadb5de0c52ae3f6 0.2s => [internal] load build context 0.0s => => transferring context: 1.21kB 0.0s [+] Building 3.4s (4/7) docker:default => [internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 111B 0.0s => [internal] load metadata for docker.io/library/python:3.13-slim 0.8s => [internal] load .dockerignore 0.0s => => transferring context: 2B 0.0s => [1/3] FROM docker.io/library/python:3.13-slim@sha256:168d3a5d10f2152f8e8d77b6843ac82c22a8 2.5s => => resolve docker.io/library/python:3.13-slim@sha256:168d3a5d10f2152f8e8d77b6843ac82c22a8 0.0s => => sha256:5a68082d8c2a89d359aeceb86b41906db17bb84f454d9ea6af2ae3e011d30b85 246B / 246B 0.0s => => sha256:cda0d73a344742ea41760acd07d884d384ede45b49e9efc24569acc6006a1 11.86MB / 11.86MB 1.1s => => sha256:374d74f3f7088077af53ff5725d7942c1f65ebe6eeb72161bbd37954fb861ee 1.27MB / 1.27MB 0.5s => => sha256:48fb00926fe468d83ca04ee6775f36350d17e0f328dfcb03aadb5de0c52ae 30.20MB / 30.20MB 2.2s => => extracting sha256:48fb00926fe468d83ca04ee6775f36350d17e0f328dfcb03aadb5de0c52ae3f6 0.3s => [internal] load build context 0.0s => => transferring context: 1.21kB 0.0s [+] Building 3.4s (5/7) docker:default => [internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 111B 0.0s => [internal] load metadata for docker.io/library/python:3.13-slim 0.8s => [internal] load .dockerignore 0.0s => => transferring context: 2B 0.0s => [1/3] FROM docker.io/library/python:3.13-slim@sha256:168d3a5d10f2152f8e8d77b6843ac82c22a8 2.6s => => resolve docker.io/library/python:3.13-slim@sha256:168d3a5d10f2152f8e8d77b6843ac82c22a8 0.0s => => sha256:5a68082d8c2a89d359aeceb86b41906db17bb84f454d9ea6af2ae3e011d30b85 246B / 246B 0.0s => => sha256:cda0d73a344742ea41760acd07d884d384ede45b49e9efc24569acc6006a1 11.86MB / 11.86MB 1.1s => => sha256:374d74f3f7088077af53ff5725d7942c1f65ebe6eeb72161bbd37954fb861ee 1.27MB / 1.27MB 0.5s => => sha256:48fb00926fe468d83ca04ee6775f36350d17e0f328dfcb03aadb5de0c52ae 30.20MB / 30.20MB 2.2s => => extracting sha256:48fb00926fe468d83ca04ee6775f36350d17e0f328dfcb03aadb5de0c52ae3f6 0.3s => [internal] load build context 0.0s => => transferring context: 1.21kB 0.0s [+] Building 3.6s (4/7) docker:default => [internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 111B 0.0s => [internal] load metadata for docker.io/library/python:3.13-slim 0.8s => [internal] load .dockerignore 0.0s => => transferring context: 2B 0.0s => [1/3] FROM docker.io/library/python:3.13-slim@sha256:168d3a5d10f2152f8e8d77b6843ac82c22a8 2.8s => => resolve docker.io/library/python:3.13-slim@sha256:168d3a5d10f2152f8e8d77b6843ac82c22a8 0.0s => => sha256:5a68082d8c2a89d359aeceb86b41906db17bb84f454d9ea6af2ae3e011d30b85 246B / 246B 0.0s => => sha256:cda0d73a344742ea41760acd07d884d384ede45b49e9efc24569acc6006a1 11.86MB / 11.86MB 1.1s => => sha256:374d74f3f7088077af53ff5725d7942c1f65ebe6eeb72161bbd37954fb861ee 1.27MB / 1.27MB 0.5s => => sha256:48fb00926fe468d83ca04ee6775f36350d17e0f328dfcb03aadb5de0c52ae 30.20MB / 30.20MB 2.2s => => extracting sha256:48fb00926fe468d83ca04ee6775f36350d17e0f328dfcb03aadb5de0c52ae3f6 0.3s => => extracting sha256:374d74f3f7088077af53ff5725d7942c1f65ebe6eeb72161bbd37954fb861ee0 0.0s => => extracting sha256:cda0d73a344742ea41760acd07d884d384ede45b49e9efc24569acc6006a15eb 0.2s => [internal] load build context 0.0s => => transferring context: 1.21kB 0.0s [+] Building 3.6s (5/7) docker:default => [internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 111B 0.0s => [internal] load metadata for docker.io/library/python:3.13-slim 0.8s => [internal] load .dockerignore 0.0s => => transferring context: 2B 0.0s => [1/3] FROM docker.io/library/python:3.13-slim@sha256:168d3a5d10f2152f8e8d77b6843ac82c22a8 2.8s => => resolve docker.io/library/python:3.13-slim@sha256:168d3a5d10f2152f8e8d77b6843ac82c22a8 0.0s => => sha256:5a68082d8c2a89d359aeceb86b41906db17bb84f454d9ea6af2ae3e011d30b85 246B / 246B 0.0s => => sha256:cda0d73a344742ea41760acd07d884d384ede45b49e9efc24569acc6006a1 11.86MB / 11.86MB 1.1s => => sha256:374d74f3f7088077af53ff5725d7942c1f65ebe6eeb72161bbd37954fb861ee 1.27MB / 1.27MB 0.5s => => sha256:48fb00926fe468d83ca04ee6775f36350d17e0f328dfcb03aadb5de0c52ae 30.20MB / 30.20MB 2.2s => => extracting sha256:48fb00926fe468d83ca04ee6775f36350d17e0f328dfcb03aadb5de0c52ae3f6 0.3s => => extracting sha256:374d74f3f7088077af53ff5725d7942c1f65ebe6eeb72161bbd37954fb861ee0 0.0s => => extracting sha256:cda0d73a344742ea41760acd07d884d384ede45b49e9efc24569acc6006a15eb 0.2s => [internal] load build context 0.0s => => transferring context: 1.21kB 0.0s [+] Building 3.8s (5/7) docker:default => [internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 111B 0.0s => [internal] load metadata for docker.io/library/python:3.13-slim 0.8s => [internal] load .dockerignore 0.0s => => transferring context: 2B 0.0s => [1/3] FROM docker.io/library/python:3.13-slim@sha256:168d3a5d10f2152f8e8d77b6843ac82c22a8 2.8s => => resolve docker.io/library/python:3.13-slim@sha256:168d3a5d10f2152f8e8d77b6843ac82c22a8 0.0s => => sha256:5a68082d8c2a89d359aeceb86b41906db17bb84f454d9ea6af2ae3e011d30b85 246B / 246B 0.0s => => sha256:cda0d73a344742ea41760acd07d884d384ede45b49e9efc24569acc6006a1 11.86MB / 11.86MB 1.1s => => sha256:374d74f3f7088077af53ff5725d7942c1f65ebe6eeb72161bbd37954fb861ee 1.27MB / 1.27MB 0.5s => => sha256:48fb00926fe468d83ca04ee6775f36350d17e0f328dfcb03aadb5de0c52ae 30.20MB / 30.20MB 2.2s => => extracting sha256:48fb00926fe468d83ca04ee6775f36350d17e0f328dfcb03aadb5de0c52ae3f6 0.3s => => extracting sha256:374d74f3f7088077af53ff5725d7942c1f65ebe6eeb72161bbd37954fb861ee0 0.0s => => extracting sha256:cda0d73a344742ea41760acd07d884d384ede45b49e9efc24569acc6006a15eb 0.2s => => extracting sha256:5a68082d8c2a89d359aeceb86b41906db17bb84f454d9ea6af2ae3e011d30b85 0.0s => [internal] load build context 0.0s => => transferring context: 1.21kB 0.0s => [2/3] WORKDIR /app 0.2s [+] Building 3.8s (6/7) docker:default => [internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 111B 0.0s => [internal] load metadata for docker.io/library/python:3.13-slim 0.8s => [internal] load .dockerignore 0.0s => => transferring context: 2B 0.0s => [1/3] FROM docker.io/library/python:3.13-slim@sha256:168d3a5d10f2152f8e8d77b6843ac82c22a8 2.8s => => resolve docker.io/library/python:3.13-slim@sha256:168d3a5d10f2152f8e8d77b6843ac82c22a8 0.0s => => sha256:5a68082d8c2a89d359aeceb86b41906db17bb84f454d9ea6af2ae3e011d30b85 246B / 246B 0.0s => => sha256:cda0d73a344742ea41760acd07d884d384ede45b49e9efc24569acc6006a1 11.86MB / 11.86MB 1.1s => => sha256:374d74f3f7088077af53ff5725d7942c1f65ebe6eeb72161bbd37954fb861ee 1.27MB / 1.27MB 0.5s => => sha256:48fb00926fe468d83ca04ee6775f36350d17e0f328dfcb03aadb5de0c52ae 30.20MB / 30.20MB 2.2s => => extracting sha256:48fb00926fe468d83ca04ee6775f36350d17e0f328dfcb03aadb5de0c52ae3f6 0.3s => => extracting sha256:374d74f3f7088077af53ff5725d7942c1f65ebe6eeb72161bbd37954fb861ee0 0.0s => => extracting sha256:cda0d73a344742ea41760acd07d884d384ede45b49e9efc24569acc6006a15eb 0.2s => => extracting sha256:5a68082d8c2a89d359aeceb86b41906db17bb84f454d9ea6af2ae3e011d30b85 0.0s => [internal] load build context 0.0s => => transferring context: 1.21kB 0.0s => [2/3] WORKDIR /app 0.2s [+] Building 3.9s (8/8) FINISHED docker:default => [internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 111B 0.0s => [internal] load metadata for docker.io/library/python:3.13-slim 0.8s => [internal] load .dockerignore 0.0s => => transferring context: 2B 0.0s => [1/3] FROM docker.io/library/python:3.13-slim@sha256:168d3a5d10f2152f8e8d77b6843ac82c22a8 2.8s => => resolve docker.io/library/python:3.13-slim@sha256:168d3a5d10f2152f8e8d77b6843ac82c22a8 0.0s => => sha256:5a68082d8c2a89d359aeceb86b41906db17bb84f454d9ea6af2ae3e011d30b85 246B / 246B 0.0s => => sha256:cda0d73a344742ea41760acd07d884d384ede45b49e9efc24569acc6006a1 11.86MB / 11.86MB 1.1s => => sha256:374d74f3f7088077af53ff5725d7942c1f65ebe6eeb72161bbd37954fb861ee 1.27MB / 1.27MB 0.5s => => sha256:48fb00926fe468d83ca04ee6775f36350d17e0f328dfcb03aadb5de0c52ae 30.20MB / 30.20MB 2.2s => => extracting sha256:48fb00926fe468d83ca04ee6775f36350d17e0f328dfcb03aadb5de0c52ae3f6 0.3s => => extracting sha256:374d74f3f7088077af53ff5725d7942c1f65ebe6eeb72161bbd37954fb861ee0 0.0s => => extracting sha256:cda0d73a344742ea41760acd07d884d384ede45b49e9efc24569acc6006a15eb 0.2s => => extracting sha256:5a68082d8c2a89d359aeceb86b41906db17bb84f454d9ea6af2ae3e011d30b85 0.0s => [internal] load build context 0.0s => => transferring context: 1.21kB 0.0s => [2/3] WORKDIR /app 0.2s => [3/3] COPY app.py . 0.0s => exporting to image 0.0s => => exporting layers 0.0s => => exporting manifest sha256:602d089cc31a8588c758489b0661cb059692e0814a1fe4127977f7752aef 0.0s => => exporting config sha256:34b73ffeab80edeae7cdc7ea5f8c24b6ad2950169f7c166e0113a050c93c0e 0.0s => => exporting attestation manifest sha256:ad36c67afe7f523c04db1c36c7bee0f972a9ca8a674fdd67 0.0s => => exporting manifest list sha256:f3e8d500d9a32a248922ae5048eaa822e88d1b7b10a29008ac3224c 0.0s => => naming to docker.io/library/myapp:1.0 0.0s => => unpacking to docker.io/library/myapp:1.0 0.0s
An image never runs by itself. It's the package. A container is a running copy started from it. Start one, or three, from the same image, and each one runs fenced off from the rest.

docker run starts a container from it. One option keeps it in the background, one connects port 8080 on the server to your app, and one says: if it ever stops by itself, start it again. docker ps lists it: up. And curl, a tool that sends one web request, gets an answer: the app replies with its version, 1, and the name of the container that answered.
docker run -d --name myapp -p 8080:8080 --restart unless-stopped myapp:1.075cd4f1bb092a08bd1b5e9549ab07b6599ba9a6e63842d5247d81b55d0bd0a9a
docker ps --format 'table {{.Names}}\t{{.Image}}\t{{.Status}}'NAMES IMAGE STATUS myapp myapp:1.0 Up 1 second
curl localhost:8080myapp v1 on 75cd4f1bb092
Now crash it on purpose: your app has a special page, /crash, that makes it quit. A second later, docker ps shows it up again, and Docker counted one restart. So Docker restarts a crashed container by itself: for that, you don't need Kubernetes. But only on its own machine.
curl localhost:8080/crashcrashing
docker ps --format 'table {{.Names}}\t{{.Image}}\t{{.Status}}'NAMES IMAGE STATUS myapp myapp:1.0 Up 1 second
docker inspect -f '{{.RestartCount}}' myapp1
Where Docker alone stops
Apps change. So what do your users see while you swap in version 2? To find out, your laptop asks for the version several times a second, and prints an x whenever nothing answers. One line changes, docker build makes myapp 2.0, and you remove the old container and start the new one. Three x's. Three requests failed during the swap. Your app starts in a fraction of a second; a slower app leaves a longer gap.
grep -n '^VERSION' app.py9:VERSION = "2"
docker build -q -t myapp:2.0 .sha256:84acf8a6954e7d2702a8db237b2299ec4c72140b5b7b7ce7f4355ea86cac5ae8
docker rm -f myapp && docker run -d --name myapp -p 8080:8080 --restart unless-stopped myapp:2.0myapp 2d14bac809b0766f02ebf0c2324e59be7f26c89bbdb79cd6e1a003ccb8a9277e
for i in $(seq 60); do curl -s -m 1 server1:8080/v || printf x; sleep 0.1; done; echo1111111111111111111111xxx22222222222222222222222222222222222
And your app lives on server1 alone. In this lab, server1 isn't a real computer: it's a pretend server running on the laptop, so docker stop server1 is like pulling its power cord. Now curl can't connect: your app is down. Start server1 again, and Docker restarts your app, but only once that one machine is back.
docker stop server1server1
curl -sS -m 5 server1:8080curl: (7) Failed to connect to server1 port 8080 after 4074 ms: Couldn't connect to server
docker start server1server1
curl -s server1:8080myapp v2 on 2d14bac809b0
So what keeps your app answering when its machine dies? Keeping copies running across several machines is a different job, called orchestration. Kubernetes is built for exactly that job.

Kubernetes: a cluster and a list
Think of shipping. Your image is like a standard shipping box: any truck can carry it. Docker alone is one truck: if it breaks down, your box stops with it. Kubernetes is a dispatcher with a fleet of trucks and a list that says: keep three boxes on the road. When a truck breaks down, the dispatcher puts a new copy on another truck.
In Kubernetes, the fleet is a cluster, and each machine in it is a node. The control plane takes your list and decides which node runs what. The workers run your containers. And you talk to it all from your laptop, with kubectl: the command-line tool for Kubernetes.
A free tool called kind, which runs Kubernetes inside Docker, builds a practice cluster like that on one laptop, with each node a container. In a real cluster, each node is its own server. This file asks for one control plane and two workers. kind took 27 seconds. Then kubectl lists the three nodes, and each says Ready: the control plane, lab-worker and lab-worker2.
cat cluster.yamlkind: Cluster apiVersion: kind.x-k8s.io/v1alpha4 name: lab nodes: - role: control-plane - role: worker - role: worker
time kind create cluster --config cluster.yamlCreating cluster "lab" ... • Ensuring node image (kindest/node:v1.37.0) 🖼️ ... ✓ Ensuring node image (kindest/node:v1.37.0) 🖼️ • Preparing nodes 📦 📦 📦 ... ✓ Preparing nodes 📦 📦 📦 • Writing configuration 📜 ... ✓ Writing configuration 📜 • Starting control-plane 🕹️ ... ✓ Starting control-plane 🕹️ • Installing CNI 🔌 ... ✓ Installing CNI 🔌 • Installing StorageClass 💾 ... ✓ Installing StorageClass 💾 • Joining worker nodes 🚜 ... ✓ Joining worker nodes 🚜 Set kubectl context to "kind-lab" You can now use your cluster with: kubectl cluster-info --context kind-lab Have a question, bug, or feature request? Let us know! https://kind.sigs.k8s.io/#community 🙂 real 0m27.095s user 0m0.433s sys 0m0.358s
kubectl get nodesNAME STATUS ROLES AGE VERSION lab-control-plane Ready control-plane 26s v1.37.0 lab-worker Ready <none> 12s v1.37.0 lab-worker2 Ready <none> 12s v1.37.0
The same image, no Docker inside
Here's a common mix-up: does Kubernetes replace Docker, or run on top of it? Kubernetes doesn't build images. Docker on the laptop builds the same myapp 1.0, and kind load copies it onto every node. Guess first: to run it, does each node use Docker? No. Each node is a container on your laptop, but inside it, Kubernetes uses containerd: a container runtime, the part that starts and stops containers. Ask a node, and it has containerd, and no docker at all. So Kubernetes doesn't replace Docker or run on top of it: Docker builds the box, Kubernetes runs it.
docker build -q -t myapp:1.0 .sha256:88aa862a474bc378652c5d924541706abb3303a4886241020ee7e7d99fb63979
kind load docker-image myapp:1.0 --name labImage: "myapp:1.0" with ID "sha256:88aa862a474bc378652c5d924541706abb3303a4886241020ee7e7d99fb63979" not yet present on node "lab-worker2", loading... Image: "myapp:1.0" with ID "sha256:88aa862a474bc378652c5d924541706abb3303a4886241020ee7e7d99fb63979" not yet present on node "lab-control-plane", loading... Image: "myapp:1.0" with ID "sha256:88aa862a474bc378652c5d924541706abb3303a4886241020ee7e7d99fb63979" not yet present on node "lab-worker", loading...
kubectl get nodes -o custom-columns=NODE:.metadata.name,RUNTIME:.status.nodeInfo.containerRuntimeVersionNODE RUNTIME lab-control-plane containerd://2.3.4 lab-worker containerd://2.3.4 lab-worker2 containerd://2.3.4
docker exec lab-worker which docker containerd/usr/local/bin/containerd
Kubernetes used to talk to Docker directly, until version 1.24. Now it uses runtimes like containerd, and any image Docker builds still runs there.
Your list: three copies
Docker gave you one copy, on one machine. Can Kubernetes keep three running, spread over two? First, you write your list. In Kubernetes, that list is a file called a Deployment: it says what you want, not how to do it. Here: three replicas, meaning three copies, of the image myapp 1.0. And a readiness check: a copy gets no requests until its version page, /v, answers.
cat deployment.yamlapiVersion: apps/v1 kind: Deployment metadata: name: myapp spec: replicas: 3 selector: matchLabels: app: myapp template: metadata: labels: app: myapp spec: containers: - name: myapp image: myapp:1.0 readinessProbe: httpGet: path: /v port: 8080
Your copies can be on any node, and they get replaced, so you need one fixed way in. That's a Service: port 30080, on every node, hands each request to one of the copies, on its port 8080. kubectl apply gives both files to the control plane.
cat service.yamlapiVersion: v1 kind: Service metadata: name: myapp spec: type: NodePort selector: app: myapp ports: - port: 8080 nodePort: 30080
kubectl apply -f deployment.yaml -f service.yamldeployment.apps/myapp created service/myapp created
There are your three copies. Kubernetes runs each one in a pod: the smallest thing it runs, wrapped around your container. Two pods on lab-worker, one on lab-worker2. Six requests to lab-worker, and all three pods answer, on both machines: the Service passes requests between the machines.
kubectl get pods -o custom-columns=POD:.metadata.name,STATUS:.status.phase,NODE:.spec.nodeNamePOD STATUS NODE myapp-67b5f6f89c-j7fvs Running lab-worker myapp-67b5f6f89c-mbq9p Running lab-worker myapp-67b5f6f89c-t7h2x Running lab-worker2
for i in 1 2 3 4 5 6; do curl -s lab-worker:30080; donemyapp v1 on myapp-67b5f6f89c-j7fvs myapp v1 on myapp-67b5f6f89c-t7h2x myapp v1 on myapp-67b5f6f89c-t7h2x myapp v1 on myapp-67b5f6f89c-j7fvs myapp v1 on myapp-67b5f6f89c-mbq9p myapp v1 on myapp-67b5f6f89c-j7fvs
When a copy breaks
Your list says three copies. So what happens if one disappears? Delete one pod by hand. By the time kubectl comes back, a new one is running, with a new name. Crash one, and the node restarts it, like Docker did: kubectl counts one restart.
kubectl delete pod myapp-67b5f6f89c-j7fvspod "myapp-67b5f6f89c-j7fvs" deleted from default namespace
kubectl get podsNAME READY STATUS RESTARTS AGE myapp-67b5f6f89c-6c9tj 1/1 Running 0 4s myapp-67b5f6f89c-mbq9p 1/1 Running 0 11s myapp-67b5f6f89c-t7h2x 1/1 Running 0 11s
curl -s lab-worker:30080/crashcrashing
kubectl get podsNAME READY STATUS RESTARTS AGE myapp-67b5f6f89c-6c9tj 1/1 Running 0 6s myapp-67b5f6f89c-mbq9p 1/1 Running 1 (2s ago) 13s myapp-67b5f6f89c-t7h2x 1/1 Running 0 13s
That's the core idea of Kubernetes. You write down what you want. The control plane compares it with what's really running, and fixes any difference, over and over: a missing copy, a crashed one, or a lost machine.
Need more copies? Change one number in your list, what Kubernetes calls a Deployment: kubectl scale to five, and five pods run, across both machines. With Docker alone, that's five docker run commands, five ports, and something in front to share out the requests. Then back to three, for the next test.
kubectl scale deployment myapp --replicas=5deployment.apps/myapp scaled
kubectl get pods -o custom-columns=POD:.metadata.name,STATUS:.status.phase,NODE:.spec.nodeNamePOD STATUS NODE myapp-67b5f6f89c-4z6sq Running lab-worker myapp-67b5f6f89c-6c9tj Running lab-worker2 myapp-67b5f6f89c-mbq9p Running lab-worker myapp-67b5f6f89c-sxfpd Running lab-worker myapp-67b5f6f89c-t7h2x Running lab-worker2
A new version, the Kubernetes way
Remember the 3 failed requests when Docker swapped versions? Here's version 2 the Kubernetes way. Build it, load it, change the image line to myapp 2.0, and run kubectl apply while your laptop keeps asking. Guess first: how many requests fail this time? None. Not one x. Kubernetes started a new copy, waited until it was running and answering requests, then stopped an old one, one at a time. For a moment, versions 1 and 2 both answered.
kind load docker-image myapp:2.0 --name labImage: "myapp:2.0" with ID "sha256:9acfb1375e377c837989fedbeec3084ff52bf459d9b4a9f5e0b2ccdadd2e19d9" not yet present on node "lab-worker2", loading... Image: "myapp:2.0" with ID "sha256:9acfb1375e377c837989fedbeec3084ff52bf459d9b4a9f5e0b2ccdadd2e19d9" not yet present on node "lab-control-plane", loading... Image: "myapp:2.0" with ID "sha256:9acfb1375e377c837989fedbeec3084ff52bf459d9b4a9f5e0b2ccdadd2e19d9" not yet present on node "lab-worker", loading...
grep image: deployment.yamlimage: myapp:2.0
kubectl apply -f deployment.yamldeployment.apps/myapp configured
for i in $(seq 120); do curl -s -m 1 lab-worker:30080/v || printf x; sleep 0.1; done; echo111111111111111111111111111111111111112111112112212222121222222222222222222222222222222222222222222222222222222222222222
kubectl rollout status deployment/myappWaiting for deployment "myapp" rollout to finish: 1 out of 3 new replicas have been updated... Waiting for deployment "myapp" rollout to finish: 1 out of 3 new replicas have been updated... Waiting for deployment "myapp" rollout to finish: 1 out of 3 new replicas have been updated... Waiting for deployment "myapp" rollout to finish: 2 out of 3 new replicas have been updated... Waiting for deployment "myapp" rollout to finish: 2 out of 3 new replicas have been updated... Waiting for deployment "myapp" rollout to finish: 2 out of 3 new replicas have been updated... Waiting for deployment "myapp" rollout to finish: 1 old replicas are pending termination... Waiting for deployment "myapp" rollout to finish: 1 old replicas are pending termination... deployment "myapp" successfully rolled out
When a machine dies
Now the real test. Two copies run on lab-worker, one on lab-worker2. Switch lab-worker2 off, the lab's way of pulling a node's power cord, while your laptop keeps asking.
kubectl get pods -o custom-columns=POD:.metadata.name,STATUS:.status.phase,NODE:.spec.nodeNamePOD STATUS NODE myapp-86c7d7b466-8mkp8 Running lab-worker myapp-86c7d7b466-qsqg8 Running lab-worker myapp-86c7d7b466-szqqg Running lab-worker2
docker stop lab-worker2lab-worker2
For about fifty seconds, some requests failed, 14 of 60, because they still went to the pod on the dead machine. That's how long Kubernetes waits before it decides a silent node is down and marks it NotReady. kubectl wait measured it. After that, every request goes to the pods on lab-worker.
for i in $(seq 60); do curl -s -m 1 lab-worker:30080/v || printf x; sleep 0.5; done; echo2222222222x2x222222222xx22222xx2xx22x2x22222x22x2222x22x2222
time kubectl wait --for=condition=Ready=Unknown node/lab-worker2 --timeout=180snode/lab-worker2 condition met real 0m49.559s user 0m0.026s sys 0m0.010s
kubectl get nodesNAME STATUS ROLES AGE VERSION lab-control-plane Ready control-plane 2m9s v1.37.0 lab-worker Ready <none> 115s v1.37.0 lab-worker2 NotReady <none> 115s v1.37.0
for i in 1 2 3 4; do curl -s lab-worker:30080; donemyapp v2 on myapp-86c7d7b466-8mkp8 myapp v2 on myapp-86c7d7b466-8mkp8 myapp v2 on myapp-86c7d7b466-qsqg8 myapp v2 on myapp-86c7d7b466-8mkp8
But your list says three copies, and only two are running. Guess first: how long until Kubernetes starts a new copy on lab-worker? About five more minutes. Every pod gets 300 seconds of patience for a node that stops answering, in case it comes back.
kubectl rollout status waits for three ready copies. All in all, almost six minutes after the switch-off, the new pod runs on lab-worker. The old one still says Terminating: its dead node can't confirm it stopped. And after those first 50 seconds, every request we sent was answered by lab-worker's two copies. With Docker alone, nothing would have moved. Five minutes too long for your app? You can shorten it in the pod's settings.
time kubectl rollout status deployment/myappWaiting for deployment "myapp" rollout to finish: 2 of 3 updated replicas are available... Waiting for deployment "myapp" rollout to finish: 2 out of 3 new replicas have been updated... Waiting for deployment "myapp" rollout to finish: 2 of 3 updated replicas are available... deployment "myapp" successfully rolled out real 5m1.267s user 0m0.040s sys 0m0.021s
kubectl get pods -o custom-columns=POD:.metadata.name,STATUS:.status.phase,NODE:.spec.nodeNamePOD STATUS NODE myapp-86c7d7b466-7fs4d Running lab-worker myapp-86c7d7b466-8mkp8 Running lab-worker myapp-86c7d7b466-qsqg8 Running lab-worker myapp-86c7d7b466-szqqg Running lab-worker2
kubectl get podsNAME READY STATUS RESTARTS AGE myapp-86c7d7b466-7fs4d 1/1 Running 0 1s myapp-86c7d7b466-8mkp8 1/1 Running 0 6m4s myapp-86c7d7b466-qsqg8 1/1 Running 0 6m6s myapp-86c7d7b466-szqqg 1/1 Terminating 0 6m5s
What Kubernetes costs
All this has a price. server1, the Docker-only server from earlier, used 113 megabytes of memory, your app included. Each Kubernetes worker used about 200, and the control plane alone used 665. That's about 1,100 megabytes: nearly ten times as much.

Kubernetes also runs 12 pods of its own, just to manage itself: a database that remembers the cluster, a front door for kubectl, a scheduler that picks a node for each pod, and a controller that keeps your list true.
kubectl get pods -n kube-system -o custom-columns=POD:.metadata.name,NODE:.spec.nodeNamePOD NODE coredns-559f6c778d-52jrw lab-control-plane coredns-559f6c778d-56q52 lab-control-plane etcd-lab-control-plane lab-control-plane kindnet-c45fd lab-control-plane kindnet-gx5nt lab-worker2 kindnet-scqqr lab-worker kube-apiserver-lab-control-plane lab-control-plane kube-controller-manager-lab-control-plane lab-control-plane kube-proxy-8jtm5 lab-worker kube-proxy-clr2s lab-worker2 kube-proxy-z2x7s lab-control-plane kube-scheduler-lab-control-plane lab-control-plane
Which one do you need?
So which one? One server, and an app that can be down for a few minutes now and then: Docker alone is enough. Several servers, updates with no failed requests, copies that move when a machine dies: that's Kubernetes. And either way, Docker can build the images.

If Docker and Kubernetes finally make sense, subscribe for more labs like this one. And a like helps YouTube show this to more beginners.
The lab files and every command are in the description, so you can build the same cluster and switch a machine off yourself. Thanks for watching Cloud Explainers.
Sources
Demos: containers on our own Mac standing in for your laptop, a server and a three-machine cluster. The app is made up; every command, output and number was real. Watch the full video on YouTube.