Courseiva
Container Orchestration →easyMultiple Choice

KCNA Container Orchestration Practice Question

A developer wants to run a one-off database migration task in Kubernetes that must complete successfully and then stop. The task should not restart after successful completion, and the developer wants to inspect logs after it finishes. Which resource should be created?

⚠ Common exam trap

Many candidates confuse a Job with a Deployment and assuming that a single-replica Deployment will run a task just once.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

✓

A Job with restartPolicy set to OnFailure or Never

A Job is the correct resource for run-to-completion tasks. By setting the Pod template's restartPolicy to OnFailure or Never, the container stops after a successful exit, and the Job records completion. The completed Pod remains for log inspection, unlike a Deployment or bare Pod with Always restart policy, which would keep restarting the container.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✗

    A bare Pod with restartPolicy set to Always

    Why it's wrong here

    A bare Pod with restartPolicy Always will restart the container even after it exits successfully. This causes the migration to loop indefinitely and never reach a stable completed state. Bare Pods also lack the Job controller's completion tracking and retry semantics, making them unsuitable for run-to-completion work.

  • ✗

    A CronJob with schedule set to a date in the past

    Why it's wrong here

    A CronJob creates Jobs on a recurring schedule. Setting a past date does not guarantee a single execution and may cause the controller to skip or repeatedly attempt runs depending on the startingDeadlineSeconds and concurrency policy. It adds unnecessary scheduling complexity for a task that only needs to run once immediately.

  • ✗

    A Deployment with a single replica

    Why it's wrong here

    A Deployment maintains a desired number of running Pods continuously. If the migration container exits successfully, the ReplicaSet controller treats the Pod as failed and creates a replacement, causing the migration to run repeatedly. This resource is meant for long-running services, not one-off tasks that must stop after success.

  • ✓

    A Job with restartPolicy set to OnFailure or Never

    Why this is correct

    A Job is designed for run-to-completion workloads. Setting the Pod template's restartPolicy to OnFailure or Never ensures the container is not restarted after it exits successfully. The Job controller tracks successful completions, and the completed Pod remains available for log inspection until manually deleted or cleaned up by a TTL controller.

About these practice questions

Courseiva writes every KCNA question from scratch — 930 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written and reviewed by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

Last reviewed September 2026 · checked against the official CNCF exam blueprint

This KCNA practice question is part of Courseiva's free CNCF certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the KCNA exam.