Practice & Assessment
Test your understanding of Scaling, Scheduling, and Resource Management
Multiple Choice Questions
5An HPA is configured with minReplicas=2, maxReplicas=10, and targetCPUUtilization=70%. Current CPU is at 140% across 2 Pods. How many replicas will the HPA scale to?
A node has the taint `gpu=true:NoSchedule`. A Pod has no tolerations. What happens when this Pod is scheduled?
You need to run a log collection agent on every node in a cluster, including nodes added in the future. Which workload resource should you use?
What is the difference between `requiredDuringSchedulingIgnoredDuringExecution` and `preferredDuringSchedulingIgnoredDuringExecution` in node affinity?
A CronJob has `concurrencyPolicy: Forbid`. The 2am run is still executing at 3am when the next run is due. What happens?
Coding Challenges
1Autoscale a Web App Under Load
Deploy an nginx:1.25 Deployment named 'load-test' with 2 replicas, CPU request 100m, CPU limit 200m. Create an HPA targeting 50% CPU utilization with min=2 and max=8 replicas. Install metrics-server in your kind cluster. Generate CPU load by running a busybox Pod that calls the nginx Service in a loop: `while true; do wget -q -O- http://load-test-svc; done`. Observe HPA scaling with `kubectl get hpa -w`. Expected output: replica count increases above 2 while load runs; scales back toward 2 after load stops. Time estimate: 30 minutes.
Mini Project
Cluster-Wide Monitoring and Batch Processing Setup
Implement three separate concerns on your local kind cluster. First, deploy Prometheus Node Exporter as a DaemonSet in the 'monitoring' namespace using a hostPath volume for /proc, ensuring it runs on all nodes. Second, create a CronJob in namespace 'jobs' that runs every 5 minutes, executes a shell script printing cluster timestamp and node count (use kubectl in the container with appropriate ServiceAccount), and retains 3 successful and 1 failed job history. Third, configure node affinity on a sample nginx Deployment to prefer (not require) nodes with label 'tier=app'. Label your kind control-plane node with that label and verify pod placement. Write a summary README documenting each resource and what you observed.
