Lab 6: Deploy & Scale¶
| Field | Value |
|---|---|
| Tier | 2 — Kubernetes Core |
| Estimated Time | 45 minutes |
| Prerequisites | k3s cluster, kubectl |
| Auto-Grade | Yes |
Scenario¶
Your company is migrating a three-tier web application from VMs to Kubernetes. The application has a React frontend served by nginx, a Python Flask API server, and a PostgreSQL database. The previous ops team started writing Kubernetes manifests but left the project half-done. The deployments exist but are missing resource limits, the frontend has only one replica (it should have three), and the API server keeps getting OOM-killed because nobody set memory limits.
The product manager wants this deployed and stable before the Monday demo. You need to complete the manifests, deploy all three tiers, configure proper resource requests and limits, set up a Horizontal Pod Autoscaler for the API, and verify the entire stack is healthy.
Objectives¶
- Deploy frontend with 3 replicas, each with resource requests (cpu: 100m, memory: 128Mi) and limits (cpu: 200m, memory: 256Mi)
- Deploy API server with 2 replicas, resource limits, and readiness probe on /health
- Deploy PostgreSQL as a single-replica Deployment with a PVC for data
- Create ClusterIP services for all three tiers
- Configure HPA for the API (min 2, max 8, target CPU 70%)
- All pods are Running and Ready within 5 minutes
- Frontend pods can reach the API service via DNS
Setup¶
Creates a namespace lab-deploy with incomplete manifests applied.
Hints¶
Hint 1: Resource requests and limits
Add under `spec.containers[].resources`:Hint 2: Readiness probes
Hint 3: HPA configuration
`kubectl autoscale deployment api --min=2 --max=8 --cpu-percent=70 -n lab-deploy`Hint 4: Service DNS
Services are reachable at `Grading¶
Solution¶
See the solution/ directory for complete manifests.