Day 3 – Kubernetes Deployment
Today's Focus
Deploy the full project stack to Kubernetes: write manifests for all services, configure environment, and validate the deployment.
Tasks
- Set up a local Kubernetes cluster with
minikube startorkind create cluster. Confirmkubectl cluster-infoshows a healthy cluster andkubectl get nodesshows the node ready. - Write Kubernetes manifests for each service: a
Deploymentwithreplicas: 2, aService(ClusterIP for internal, LoadBalancer/NodePort for externally accessible services), andConfigMapandSecretresources for configuration and credentials. - Write a
kustomization.yamlininfra/k8s/base/that references all manifests. Create aninfra/k8s/overlays/local/overlay that patches resource limits and replica counts for local development. Apply withkubectl apply -k infra/k8s/overlays/local/. - Configure resource requests and limits for every container:
requests.cpu: "100m",requests.memory: "128Mi",limits.cpu: "500m",limits.memory: "512Mi". Explain why requests and limits should not be identical and what happens when a container exceeds its memory limit. - Add a
readinessProbeandlivenessProbeto every deployment using your/healthendpoints. Watchkubectl get pods -was you apply — observe pods cycling throughContainerCreating,Running, and becomingReady. - Confirm the application works end-to-end in Kubernetes: use
kubectl port-forward service/api 8080:8080andcurl http://localhost:8080/to verify.