# Workloads, Probes and Autoscaling

> Run applications with Deployments, StatefulSets, DaemonSets and Jobs, keep them healthy with probes, and scale them automatically. Free notes, key concepts,...

Canonical: https://www.internhack.in/roadmaps/tracks/devops/k8s-workloads
Last updated: 2026-11-28

Run applications with Deployments, StatefulSets, DaemonSets and Jobs, keep them healthy with probes, and scale them automatically.

Intermediate · about 10 hours · difficulty 3/5

Learn first: [Kubernetes Architecture and kubectl](https://www.internhack.in/roadmaps/tracks/devops/kubernetes-architecture)

Pods are the unit of scheduling, but you almost never create them directly. Higher-level **workload controllers** manage pods for you.

### Controllers

- **Deployment** (via ReplicaSets): stateless apps with **rolling updates** and `kubectl rollout undo`. Tune `maxSurge` and `maxUnavailable`.
- **StatefulSet**: stable names and per-pod storage for databases and queues.
- **DaemonSet**: one pod per node (log shippers, node agents).
- **Job** and **CronJob**: run-to-completion and scheduled work.

### Keeping pods healthy

- **Resource requests** (used for scheduling) and **limits** (enforced). Without requests the scheduler is guessing; memory over the limit means an OOM kill.
- **Probes**: `readinessProbe` controls whether a pod receives traffic, `livenessProbe` restarts a stuck container, `startupProbe` protects slow starters.
- Graceful shutdown: handle SIGTERM, set `terminationGracePeriodSeconds`, and a small `preStop` sleep to let endpoints update.
- **PodDisruptionBudgets** keep capacity during node drains.

### Scaling

The **Horizontal Pod Autoscaler** scales replicas on CPU, memory or custom metrics; the **Cluster Autoscaler** or **Karpenter** adds nodes; KEDA scales on events such as queue length.

### Pitfalls

Liveness probes that check dependencies (a database blip restarts every pod), no requests set, and CrashLoopBackOff debugging without `kubectl logs --previous`.

**Good enough to move on:** you can deploy an app with requests, limits, three probes, a PDB and an HPA, and do a rolling update and rollback with zero failed requests.

## Key concepts

- **Pods and ReplicaSets**
- **Deployments and rolling updates**
- **StatefulSets and DaemonSets**
- **Jobs and CronJobs**
- **Requests and limits**
- **Readiness, liveness, startup probes**
- **PodDisruptionBudgets**
- **HPA and cluster autoscaling**
- **KEDA event-driven scaling**

## Mini project

Deploy an app with 3 replicas, probes, requests/limits and an HPA; run a load test to trigger scaling, then roll out a new version while a script hammers it and confirm zero errors.

## Check yourself

What is the difference in behaviour between a failing readiness probe and a failing liveness probe?

## Free resources

- [Kubernetes workloads](https://kubernetes.io/docs/concepts/workloads/) (kubernetes.io)
- [Configure liveness, readiness and startup probes](https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/) (kubernetes.io)

Previous: [Kubernetes Architecture and kubectl](https://www.internhack.in/roadmaps/tracks/devops/kubernetes-architecture) · Next: [Services, Ingress and Network Policy](https://www.internhack.in/roadmaps/tracks/devops/k8s-networking)

## More in Orchestrating Containers with Kubernetes

- [Kubernetes Architecture and kubectl](https://www.internhack.in/roadmaps/tracks/devops/kubernetes-architecture)
- [Workloads, Probes and Autoscaling](https://www.internhack.in/roadmaps/tracks/devops/k8s-workloads)
- [Services, Ingress and Network Policy](https://www.internhack.in/roadmaps/tracks/devops/k8s-networking)
- [Configuration, Secrets, Storage and RBAC](https://www.internhack.in/roadmaps/tracks/devops/k8s-config-storage)
- [Packaging with Helm and Kustomize](https://www.internhack.in/roadmaps/tracks/devops/helm)
- [Operators and Custom Resources](https://www.internhack.in/roadmaps/tracks/devops/k8s-operators)
- [Service Mesh](https://www.internhack.in/roadmaps/tracks/devops/service-mesh)
- [Beyond Kubernetes: Nomad and ECS](https://www.internhack.in/roadmaps/tracks/devops/nomad-ecs)

## Related

- [Roadmaps](https://www.internhack.in/roadmaps)
- [DevOps Engineer Roadmap](https://www.internhack.in/roadmaps/tracks/devops)
