Kubernetes Workloads Cheat Sheet

Deployments, StatefulSets, DaemonSets, Jobs, CronJobs, autoscaling, rollouts, and workload maintenance.

View
StandardDetailedCompact
Export
Copy the compact sheet, download it, or print it.
Download
`D` dense toggle · `C` copy all

Deployments

Create, inspect, and roll out Deployment changes.

List deployments

Show deployments across namespaces.

bashANYdeploymentget
bash
kubectl get deployments -A

Show deployments across namespaces.

Describe deployment

Inspect rollout state, replicas, and events.

bashANYdeploymentdescribe
bash
kubectl describe deployment web -n payments

Inspect rollout state, replicas, and events.

Update deployment image

Roll out a new container image.

bashANYdeploymentimagerollout
bash
kubectl set image deployment/web web=ghcr.io/acme/web:2.4.1 -n payments

Roll out a new container image.

Set deployment resources

Update requests and limits from the CLI.

bashANYdeploymentresources
bash
kubectl set resources deployment/web -c web --limits=cpu=500m,memory=512Mi --requests=cpu=200m,memory=256Mi -n payments

Update requests and limits from the CLI.

Set environment variable

Set or update environment variables.

bashANYdeploymentenv
bash
kubectl set env deployment/web APP_ENV=production -n payments

Set or update environment variables.

Watch rollout status

Block until the rollout finishes or fails.

bashANYrolloutdeployment
bash
kubectl rollout status deployment/web -n payments

Block until the rollout finishes or fails.

Show rollout history

List deployment revisions.

bashANYrollouthistory
bash
kubectl rollout history deployment/web -n payments

List deployment revisions.

Undo deployment rollout

Roll back to the previous revision.

bashANYrolloutrollback
bash
kubectl rollout undo deployment/web -n payments

Roll back to the previous revision.

Undo to specific revision

Roll back to a chosen revision.

bashANYrolloutrollback
bash
kubectl rollout undo deployment/web --to-revision=3 -n payments

Roll back to a chosen revision.

Restart deployment

Trigger a restart without changing the image.

bashANYrolloutrestart
bash
kubectl rollout restart deployment/web -n payments

Trigger a restart without changing the image.

StatefulSets and DaemonSets

Operate stateful and node-wide workloads.

List statefulsets

Show StatefulSets across namespaces.

bashANYstatefulsetget
bash
kubectl get statefulsets -A

Show StatefulSets across namespaces.

Describe statefulset

Inspect ordinal pods, PVCs, and update strategy.

bashANYstatefulsetdescribe
bash
kubectl describe statefulset postgres -n data

Inspect ordinal pods, PVCs, and update strategy.

Scale statefulset

Change StatefulSet replica count.

bashANYstatefulsetscale
bash
kubectl scale statefulset postgres --replicas=3 -n data

Change StatefulSet replica count.

Watch statefulset rollout

Wait for StatefulSet updates to finish.

bashANYstatefulsetrollout
bash
kubectl rollout status statefulset/postgres -n data

Wait for StatefulSet updates to finish.

List daemonsets

Show DaemonSets across namespaces.

bashANYdaemonsetget
bash
kubectl get daemonsets -A

Show DaemonSets across namespaces.

Describe daemonset

Inspect node coverage and update status.

bashANYdaemonsetdescribe
bash
kubectl describe daemonset node-exporter -n observability

Inspect node coverage and update status.

Restart daemonset

Trigger a rolling restart for a DaemonSet.

bashANYdaemonsetrestart
bash
kubectl rollout restart daemonset/node-exporter -n observability

Trigger a rolling restart for a DaemonSet.

Watch daemonset rollout

Watch daemonset rollout status.

bashANYdaemonsetrollout
bash
kubectl rollout status daemonset/node-exporter -n observability

Watch daemonset rollout status.

Jobs and CronJobs

Run batch and scheduled workloads.

List jobs

Show Jobs across namespaces.

bashANYjobget
bash
kubectl get jobs -A

Show Jobs across namespaces.

Describe job

Inspect completions, pods, and failures.

bashANYjobdescribe
bash
kubectl describe job db-migrate -n data

Inspect completions, pods, and failures.

Delete job

Remove a finished or failed Job.

bashANYjobdelete
bash
kubectl delete job db-migrate -n data

Remove a finished or failed Job.

Create job from cronjob

Trigger an ad hoc run from an existing CronJob.

bashANYjobcronjob
bash
kubectl create job --from=cronjob/nightly-backup manual-backup-20260305 -n ops

Trigger an ad hoc run from an existing CronJob.

List cronjobs

Show CronJobs across namespaces.

bashANYcronjobget
bash
kubectl get cronjobs -A

Show CronJobs across namespaces.

Describe cronjob

Inspect the cron schedule, history limits, and concurrency policy.

bashANYcronjobdescribe
bash
kubectl describe cronjob nightly-backup -n ops

Inspect the cron schedule, history limits, and concurrency policy.

Suspend cronjob

Pause CronJob scheduling without deleting it.

bashANYcronjobpatchsuspend
bash
kubectl patch cronjob nightly-backup -n ops -p '{"spec":{"suspend":true}}'

Pause CronJob scheduling without deleting it.

Resume cronjob

Resume a suspended CronJob.

bashANYcronjobpatchresume
bash
kubectl patch cronjob nightly-backup -n ops -p '{"spec":{"suspend":false}}'

Resume a suspended CronJob.

Autoscaling

Scale workloads manually and automatically.

Create HPA

Create a HorizontalPodAutoscaler for a deployment.

bashANYhpaautoscale
bash
kubectl autoscale deployment web --cpu-percent=70 --min=2 --max=10 -n payments

Create a HorizontalPodAutoscaler for a deployment.

List HPAs

Show HorizontalPodAutoscalers.

bashANYhpaget
bash
kubectl get hpa -A

Show HorizontalPodAutoscalers.

Describe HPA

Inspect metrics, thresholds, and scaling recommendations.

bashANYhpadescribe
bash
kubectl describe hpa web -n payments

Inspect metrics, thresholds, and scaling recommendations.

Scale replicaset

Directly scale a ReplicaSet when needed.

bashANYreplicasetscale
bash
kubectl scale replicaset web-7cbb9f9d44 --replicas=0 -n payments

Directly scale a ReplicaSet when needed.

List replicasets

Show ReplicaSets created by Deployments.

bashANYreplicasetget
bash
kubectl get rs -n payments

Show ReplicaSets created by Deployments.

Describe replicaset

Inspect pod template and controller ownership.

bashANYreplicasetdescribe
bash
kubectl describe rs web-7cbb9f9d44 -n payments

Inspect pod template and controller ownership.

Advanced Pod and Controller Operations

Shortcuts for live workload operations.

Wait for pods to become ready

Wait on readiness conditions.

bashANYwaitpodsreadiness
bash
kubectl wait --for=condition=Ready pod -l app=web -n payments --timeout=180s

Wait on readiness conditions.

Wait for deployment availability

Block until a deployment is available.

bashANYwaitdeployment
bash
kubectl wait --for=condition=Available deployment/web -n payments --timeout=180s

Block until a deployment is available.

Patch scale subresource

Update the scale subresource directly.

bashANYscalesubresource
bash
kubectl patch deployment web --subresource=scale -p '{"spec":{"replicas":8}}' -n payments

Update the scale subresource directly.

Get pods with owner references

Show which controller owns each pod.

bashANYpodowners
bash
kubectl get pods -n payments -o custom-columns=NAME:.metadata.name,OWNER:.metadata.ownerReferences[0].name

Show which controller owns each pod.

Drain node

Safely evict workloads before maintenance.

bashANYnodedrainmaintenance
bash
kubectl drain worker-02 --ignore-daemonsets --delete-emptydir-data

Safely evict workloads before maintenance.

Uncordon node

Allow new pods to schedule on a node again.

bashANYnodeuncordon
bash
kubectl uncordon worker-02

Allow new pods to schedule on a node again.

Cordon node

Mark a node unschedulable.

bashANYnodecordon
bash
kubectl cordon worker-02

Mark a node unschedulable.