Kubernetes and Cloud Native Associate (KCNA)Kubernetes FundamentalsEasy

A developer needs to create a Kubernetes object that will run a containerized application, but it should only run to completion once and then terminate. Which of the following Kubernetes objects is most suitable for this use case?

  1. ADeployment
  2. BStatefulSet
  3. CDaemonSet
  4. DJob
Show answer & explanation

Correct answer: D. Job

A Kubernetes Job is designed for one-off, finite tasks that are expected to run to completion. Deployments manage stateless applications, DaemonSets ensure a Pod runs on all (or some) nodes, and StatefulSets manage stateful applications.

Why the other options are wrong

  • A. Deployments are for running stateless applications continuously, not for single-run tasks.
  • B. StatefulSets are used for stateful applications, providing stable identities and persistent storage.
  • C. DaemonSets ensure a Pod runs on every (or selected) node, typically for cluster-level services.

Kubernetes Job

A Kubernetes Job creates one or more Pods and ensures that a specified number of them successfully terminate. It is used for batch processing or single-run tasks.

  • Runs to completion once.
  • Manages Pods that are expected to terminate successfully.
  • Can be used for parallel execution of tasks.

Memory trick: Jobs are for Jiffy tasks that Just finish.

More Kubernetes Fundamentals questions