Containers, Kubernetes, and Application Modernization
Domain 4: Containers, Kubernetes, and Application Modernization
This domain tests container fundamentals, core Kubernetes objects and probes, and the trade-offs in modernizing existing applications. Expect scenario questions about failing pods, rollout behavior, and modernization options.
Core rules
- An image is an immutable template; a container is a running instance. Images are built in layers and cached, so order Dockerfile instructions from least to most frequently changing.
- Core objects: Pod (smallest deployable unit), Deployment (declarative rollout and replica management), Service (stable virtual IP/load balancing), Ingress (HTTP routing), ConfigMap/Secret (configuration), Namespace (isolation).
- Probes: liveness restarts a stuck container; readiness removes a pod from Service endpoints; startup protects slow-starting apps. A liveness probe that checks a downstream dependency can cause cascading restarts.
- Requests reserve scheduler capacity; limits cap usage. Memory limits that are too low produce OOMKilled.
- Modernization options include rehost, replatform, refactor, repurchase, retire, and retain. Refactoring into microservices is not automatically the right choice; a strangler-fig approach reduces risk.
Worked example
A pod is CrashLoopBackOff after a ConfigMap update. The image is unchanged and worked before. The liveness probe calls /health, which checks the database; the database is briefly unavailable, so liveness fails and Kubernetes restarts the pod repeatedly. The reasoning: liveness should test only whether the process can make progress, not external dependencies. Readiness should reflect dependency availability. Fix the probe and separate concerns.
Traps
- Using the latest tag in production; it defeats reproducibility.
- Editing a ConfigMap and expecting running pods to restart automatically.
- A Service whose selector does not match pod labels.
- Calling lift-and-shift "modernization" without replatforming or refactoring benefits.
- Assuming Kubernetes is required for cloud-native architecture.