Exploring the Core Workload Resources in Kubernetes
Kubernetes workload resources are not interchangeable knobs for running a container. A Deployment, StatefulSet, DaemonSet, Job, or CronJob represents a different assumption about replica identity, scheduling, and lifecycle. The quickest way to select correctly is to ask whether instances are interchangeable, whether a stable identity matters, whether work belongs on each node, and whether the task must finish instead of run forever.
| Requirement | Starting resource | Why |
|---|---|---|
| Run interchangeable HTTP replicas | Deployment | Controller maintains a desired replica set and manages rollout |
| Run a service with stable per-Pod identity and persistent storage | StatefulSet | Ordered identities and individual storage claims can matter |
| Run one telemetry component on eligible nodes | DaemonSet | Pod placement follows node membership |
| Finish a bounded batch conversion | Job | Completion and retry semantics are the core requirement |
| Run that conversion each night | CronJob | Schedules Job creation; missed runs and concurrency policy must be considered |
A direct Pod object exists, but for most application workloads a controller is preferable because it handles recreation and desired replica counts. The official Kubernetes workload overview describes these resources and their typical roles.
Consider a stateless inventory API with three replicas. Any replica can serve any request, provided all instances use the same application contract and shared external state when needed. A Deployment manages ReplicaSets and rollouts. Choose readiness probes based on actual ability to serve requests and specify resource requests so scheduling reflects expected demand.
Do not assume the existence of three Pods implies three healthy, accessible instances. Investigate Deployment rollout status, ready endpoints, application errors, and backend dependencies separately. Choosing a controller solves a different problem from verifying that desired state was reached; evaluate both during troubleshooting.
A stateful database member may depend on its own stable name and persistent volume claim. A StatefulSet can support these identities and ordered behavior, but it does not automatically provide database replication, safe backup, failover correctness, or data consistency. Those remain application and storage responsibilities. A deployment choice should be justified by the state model, not by an assumption that “StatefulSet means data is safe.”
A log collector, storage helper, or node-local network component often belongs on each eligible node, not at an arbitrary number of replicas. DaemonSets track node membership and scheduling constraints. Review tolerations, node selectors, resource consumption, security privileges, and what happens on nodes that should not run the agent. Node-local processes frequently need sensitive host access, so minimum permissions matter.
The DaemonSet documentation lists common node-level use cases.
A reporting export that reads a fixed data snapshot should terminate with a success or failure state. Job retries and parallelism need idempotent behavior; otherwise a partially failed run can write duplicate output. A CronJob schedules such runs, but time zones, concurrent executions, and missed schedules must be defined. Use a destination strategy that tolerates retries and records which input version was processed.
Test the retry path, not only the first successful run. For a payment export, for example, write to a versioned staging destination and atomically mark completion after validation.
If the workload changes from interchangeable stateless replicas to identity-sensitive storage, rethink failure recovery and service discovery before swapping resource kinds. If a container runs once per node but does not need host access, assess whether a DaemonSet is necessary or whether a shared service is safer. The controller describes placement and lifecycle, not the entire application architecture.
The right resource makes operational intent visible: continuous interchangeable service, persistent identity, node-local service, completed work, or scheduled completed work. Select it from the failure and lifecycle requirements, then test that those requirements hold.