4.5.12 · D1Software Engineering

Foundations — Kubernetes — pods, deployments, services, ingress (concepts)

1,992 words9 min readBack to topic

Before you can read the parent note Kubernetes — pods, deployments, services, ingress (concepts) without tripping, you need a small pile of ideas. This page builds each one from nothing, in an order where every idea rests on the one before it. No symbol appears before it is earned.


0. The two words everything hangs on: desired vs observed

Picture two identical shelves side by side. The left shelf is a drawing of what you asked for. The right shelf is a photo of reality. If they don't match, something must act.

Figure — Kubernetes — pods, deployments, services, ingress (concepts)

1. The symbol and the reconciliation formula

The parent note writes:

Let's earn every piece.

  • The minus sign here does not mean subtract-numbers. It means "find the difference between two situations" — like spotting what changed between the two shelves in the picture above. Read it as "the gap".
  • means "a function of" — a machine that takes an input on the inside of the brackets and produces an output. Picture a box: you drop the gap in the top, an action falls out the bottom.
  • act = the output: the concrete thing Kubernetes does (start a Pod, kill a Pod, wire up a route).
Figure — Kubernetes — pods, deployments, services, ingress (concepts)
Recall Why can't the gap "run out"?

Because the loop never ends — the function is re-evaluated continuously ::: as long as reality drifts, a new gap appears and a new action follows.


2. Declarative vs imperative — the grammar of your wishes

Kubernetes is declarative. This is not a style choice — it is forced by the reconciliation loop of §1. To re-check the gap forever, the system must always know the goal (desired state). If you only gave it steps, once the steps finished it would have nothing left to compare against.

See Declarative vs Imperative Programming to go deeper on this distinction — it's the mental model the entire topic runs on.


3. Containers — the thing being managed

Picture a shipping container: the crane (the machine) doesn't care what's inside — it just moves the standard box. Kubernetes is the crane operator for thousands of these boxes.


4. Node, cluster, and IP address

Figure — Kubernetes — pods, deployments, services, ingress (concepts)

5. Label and selector — the matchmaking pair

This is the most under-explained idea in the parent note, so we build it carefully.

Imagine a crowd where some people wear a yellow badge saying app=cart. A selector is you shouting "everyone with a yellow app=cart badge, over here!" — you never call people by name; you call by badge.

Figure — Kubernetes — pods, deployments, services, ingress (concepts)
Recall A Service scaled from 3 to 8 Pods. Did you edit the Service?

No ::: the 5 new Pods carry the same app=cart label, so the selector picks them up automatically.


6. Load balancing — spreading the work

Picture one queue feeding four checkout counters: a manager waves each customer to whichever counter is free. The manager is the load balancer. See Load Balancing.


7. DNS — turning names into addresses


8. L4 vs L7 — two heights of "networking smart"


How these foundations feed the topic

Containers

Pod

Node and Cluster

IP address

Deployment

Desired vs Observed

Reconciliation loop

Declarative vs Imperative

Label and Selector

Service

Load Balancing

DNS

Ingress

L4 vs L7

Read it bottom-up in the parent note: Containers make Pods, Deployments keep the right number of Pods, Services give Pods a stable front door, and Ingress routes outside traffic to the right Service.


Equipment checklist

Cover the right side and test yourself — if any line stumps you, revisit that section above.

Desired state vs observed state — what's the difference?
Desired = what you asked for; observed = what's actually running now.
What does the minus sign mean in ?
"The gap / difference between the two situations," not numeric subtraction.
Why must Kubernetes be declarative, not imperative?
The loop re-checks forever, so it must always know the goal to compare against; a finished script has no goal left.
What is a container, in one line?
Your program plus everything it needs to run, sealed in a portable box.
Node vs cluster?
A Node is one machine; a cluster is a managed group of Nodes.
Why is a Pod's IP not a permanent name?
It's like a hotel room number — assigned on arrival, gone when the Pod moves or dies.
Label vs selector?
A label is a key=value sticker on a Pod; a selector is a filter that grabs all Pods wearing a given sticker.
Why match Pods by label instead of by IP?
New/dead Pods auto-join or auto-leave the match; hardcoded IP lists would break constantly.
What does load balancing do?
Spreads incoming requests evenly across many identical workers.
What does DNS turn into what?
A human name (like shop.example.com) into a machine IP address.
L4 vs L7 routing?
L4 routes by IP+port only (envelope); L7 reads content like URL/host/path (opens the letter).