Workloads & Scheduling Knowledge
Test how well you understand Pods, controllers, rollout behavior, scheduling constraints, probes, resources, and batch workloads.
Focus on how workloads behave during rollout, failure, scaling, and node placement.
Questions
What is a Deployment used for?
A Deployment manages stateless applications. It creates and manages ReplicaSets, maintains the desired replica count, supports rolling updates, keeps rollout history, and can roll back to an earlier revision.
Why should most stateless applications run as Deployments instead of bare Pods?
A bare Pod is not replaced if it dies or the node disappears. A Deployment replaces failed Pods, manages rollout strategy, scales replicas, and gives you controlled updates and rollbacks.
What is the difference between a Deployment and a ReplicaSet?
A ReplicaSet maintains a stable set of Pod replicas. A Deployment manages ReplicaSets and adds rollout and rollback logic. During an update, the Deployment creates a new ReplicaSet and scales the old one down.
How do you scale a Deployment?
Use kubectl scale deployment web --replicas=5. You can also edit the Deployment spec or apply YAML with spec.replicas: 5. If an autoscaler owns replicas, check HPA behavior before manually scaling.
How do you view rollout history for a Deployment?
Use kubectl rollout history deployment/myapp. For more detail on a revision, add --revision=<number>. Meaningful history is easier when change causes are recorded or managed through Git.
How do you roll back a Deployment?
Use kubectl rollout undo deployment/myapp. You can target a specific revision with --to-revision=<number>. After rollback, watch kubectl rollout status deployment/myapp and verify Pods, events, and service endpoints.
What is the difference between Recreate and RollingUpdate strategies?
Recreate deletes old Pods before creating new ones, causing downtime but avoiding mixed old/new versions. RollingUpdate gradually replaces Pods and can keep service available when readiness probes, capacity, and rollout settings are correct.
What can make a rolling update hang even when the image is valid?
Common causes include readiness probes never passing, insufficient cluster resources, maxUnavailable too strict, PodDisruptionBudget constraints, volume attach delays, missing ConfigMaps or Secrets, affinity rules, or app startup failures.
What is a DaemonSet?
A DaemonSet ensures one Pod runs on every matching node, or on selected nodes. It is commonly used for log collectors, monitoring agents, CNI components, storage plugins, and security agents.
What is a Job in Kubernetes?
A Job runs Pods until a task completes successfully. It is useful for migrations, batch processing, one-off maintenance, and data tasks. The Job controller tracks completions and retries failed Pods according to its backoff settings.
What is a CronJob?
A CronJob creates Jobs on a cron schedule for periodic or recurring tasks. Use it for scheduled backups, reports, cleanup, sync jobs, or recurring maintenance. Watch concurrency policy, missed schedules, and job history limits.
How does a Job differ from a Deployment?
A Job runs work to completion and then stops. A Deployment keeps long-running Pods alive. Use Jobs for finite tasks and Deployments for services or processes that should continuously run.
What is a StatefulSet?
A StatefulSet manages stateful applications with stable Pod identities, stable network names, ordered deployment or termination, and persistent storage tied to each ordinal. It is useful when replicas are not interchangeable.
What are taints and tolerations?
Taints repel Pods from nodes. Tolerations allow Pods to schedule onto tainted nodes, but they do not force placement. They are commonly used for dedicated nodes, GPU nodes, control-plane nodes, and maintenance scenarios.
What is node affinity?
Node affinity constrains or prefers Pod scheduling based on node labels. Required rules must be satisfied; preferred rules influence scoring. Use it for placement by zone, hardware type, node pool, compliance boundary, or workload class.
What is Pod affinity?
Pod affinity schedules Pods close to other Pods based on labels, often within the same node, zone, or topology domain. It is useful when workloads benefit from locality, but required affinity can make scheduling harder if capacity is tight.
What is Pod anti-affinity?
Pod anti-affinity spreads Pods away from other matching Pods to improve availability. It is often used to avoid placing all replicas on one node or zone. Required anti-affinity is strict; preferred anti-affinity is more flexible.
What is the purpose of readiness probes?
Readiness probes determine when a Pod should receive traffic. If readiness fails, the Pod remains running but is removed from Service endpoints. This protects users from containers that started but are not ready to serve.
What is the purpose of liveness probes?
Liveness probes detect containers that are stuck or unhealthy and should be restarted. A bad liveness probe can create restart loops, so it should check process health rather than slow downstream dependencies.
How do readiness, liveness, and startup probes differ?
Readiness controls traffic. Liveness restarts unhealthy containers. Startup gives slow-starting apps time before liveness begins. Startup probes are useful when an app has long initialization but should still be restarted if it later hangs.
How do you run a Pod with a command override?
Use kubectl run test --image=busybox --command -- sleep 3600. The --command -- separator tells kubectl that the following tokens are the container command and arguments.
What is a Horizontal Pod Autoscaler?
A Horizontal Pod Autoscaler adjusts replica count based on CPU, memory, or custom/external metrics. It needs metrics availability and realistic resource requests. It changes Pod count, not node count.
How do you generate Deployment YAML without creating the object?
Use kubectl create deployment web --image=nginx --dry-run=client -o yaml. Redirect it to a file if you want a starter manifest, then edit labels, replicas, probes, resources, and strategy before applying.
What is a PriorityClass?
A PriorityClass defines scheduling priority for Pods. Higher-priority Pods can be scheduled ahead of lower-priority Pods and may preempt lower-priority Pods when resources are scarce. Use it carefully for truly critical workloads.