Deployment & Infra
K8s objects: multiple-choice review
Six questions that cut across the whole unit. Each one is a decision you make while writing a manifest or debugging a rollout — not a definition to recite, but a failure mode to reason through under production conditions.
Confirm you can connect the reconciliation loop, the Pod→ReplicaSet→Deployment hierarchy, Service label-selectors, probe semantics, ConfigMap/Secret behaviour, and resource requests vs limits — the synthesis the lesson built toward.
A node reboots and takes 3 of a Deployment's 5 pods with it. No human runs any command. What restores the count, and what is the underlying mechanism?
A junior runs kubectl run debug --image=busybox to start a one-off pod, and it works fine for days. Why is this still wrong for anything that must stay up?
A Deployment defines selector app=web and a Service also selects app=web. A second Deployment is later created whose pods also carry app=web. What happens to traffic?
An app needs ~25s to warm (config load + pool prime) before it can serve, and it occasionally wedges into a hung state hours later. The team adds only this: ```yaml livenessProbe: httpGet: { path: /healthz, port: 8080 } initialDelaySeconds: 30 ``` Rollouts still spike 500s. Why, and what is missing?
You update a ConfigMap consumed as env vars by a running Deployment: ```yaml envFrom: - configMapRef: { name: app-config } ``` The new value never reaches the pods even hours later. Root cause and the standard fix?
A latency-sensitive service sets: ```yaml resources: requests: { cpu: 250m, memory: 256Mi } limits: { cpu: 500m, memory: 256Mi } ``` Under load it shows periodic latency spikes and the occasional OOMKill. What are the two distinct mechanisms, and which knob is the bigger risk?
The unit’s through-line is one model: you declare desired state and controllers reconcile actual toward it forever — which is why a Deployment self-heals and a bare Pod does not. The hierarchy stacks one job per layer (Pod runs containers, ReplicaSet keeps the count, Deployment rolls and rolls back), Services select pods by label into an Endpoints set with no notion of ownership, probes split into readiness (gates traffic) and liveness (restarts), ConfigMap/Secret changes never auto-roll, and resources split into CPU (throttled, compressible) and memory (OOMKilled, incompressible). Every production failure here traces back to one of those exact semantics.