4.5.12 · D3Software Engineering

Worked examples — Kubernetes — pods, deployments, services, ingress (concepts)

2,955 words13 min readBack to topic

This page is the "run every case" companion to Kubernetes — pods, deployments, services, ingress (concepts). The parent gave you the four objects (Pod, Deployment, Service, Ingress) and the rolling-update inequalities. Here we push those rules through every boundary case: normal counts, zero, degenerate one-replica, overloaded surge, dead nodes, and the tricky arithmetic exam question everyone gets wrong.

Before we start, one reminder of the two inequalities the parent derived — because almost every example below is just plugging numbers into them.


The scenario matrix

Every case this topic can throw at you, and which example covers it.

Cell Case class What's tricky about it Example
A Normal rolling update The everyday arithmetic Ex 1
B Percentage knobs maxUnavailable: 25% must round Ex 2
C Zero surge (maxSurge=0) Update must shrink first Ex 3
D Degenerate One replica → downtime unless you surge Ex 4
E Node death / self-heal Reconciliation loop, not update Ex 5
F Scaling + label selector Endpoints list grows, clients unchanged Ex 6
G Service-type choice (reachability) Internal vs external, cost trap Ex 7
H Ingress fan-out (one LB, many Services) L7 host/path routing arithmetic Ex 8
I Exam twist: worst-case simultaneous down Combine floor + ceiling at once Ex 9

The two "numbers" cases (A–D, I) all live inside the inequality box above. The rest (E–H) test the concepts.


Cell A — Normal rolling update

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

Cell B — Percentage knobs (rounding)

Kubernetes lets you write the knobs as percentages. The rule the exam loves: maxUnavailable rounds DOWN, maxSurge rounds UP. Why opposite directions? Because both rounding choices are safe: rounding availability down keeps more Pods up; rounding surge up is harmless (you just get more headroom).


Cell C — Zero surge: the update must shrink first

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

Cell D — Degenerate case: a single replica


Cell E — Node death and the reconciliation loop


Cell F — Scaling up, clients untouched

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

Cell G — Choosing the Service type (reachability + cost)


Cell H — Ingress fan-out (L7 routing)


Cell I — Exam twist: worst-case, floor and ceiling together


Recall

Recall Every knob and boundary in one place

Floor of serving Pods during update ::: Ceiling of total Pods during update ::: maxUnavailable: 25\% of 10 replicas rounds to ::: (rounds DOWN) maxSurge: 25\% of 10 replicas rounds to ::: (rounds UP) To get zero-downtime with you must set ::: maxUnavailable: 0 (rely on surge) With maxSurge: 0, the update must ::: delete an old Pod first, then create the new one After a node dies, the count is restored by ::: the reconciliation loop (Deployment refills to ) Scaling Pods requires this many client changes ::: zero (Service address is stable) 5 microservices, 1 public: correct external LB count ::: (Ingress in front of ClusterIP services) Ingress path matching rule ::: most specific (longest) prefix wins; / is the fallback