KCNA Kubernetes Fundamentals Practice Question
Which of the following kubectl commands would you use to apply a manifest file and also save it for later updates?
⚠ Common exam trap
A common mix-up: candidates confuse `kubectl create` (which works for initial creation but fails on re-apply) with `kubectl apply` (which is idempotent and designed for ongoing updates), or they mistakenly think `kubectl replace` is equivalent to `apply` when it actually performs a full replacement without merge logic.
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
✓
kubectl apply -f manifest.yaml
`kubectl apply` uses a declarative approach: it creates the resource if it doesn't exist and updates it if it does, while also storing the last-applied configuration as an annotation (`kubectl.kubernetes.io/last-applied-configuration`). This allows future `apply` calls to perform a three-way merge diff (current live state, last-applied config, and new manifest) to intelligently update the resource, making it the standard for managing manifests that need ongoing updates.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
kubectl create -f manifest.yaml
Why it's wrong here
Create is imperative and does not track updates as well as apply.
- ✗
kubectl patch -f manifest.yaml
Why it's wrong here
Patch is for partial updates, not for applying a full manifest.
- ✗
kubectl replace -f manifest.yaml
Why it's wrong here
Replace is imperative and requires the resource to exist.
- ✓
kubectl apply -f manifest.yaml
Why this is correct
Apply is the recommended declarative approach.
Go deeper
Related to this question
About these practice questions
This KCNA question is part of Courseiva's 833-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
Same concept, more angles
2 more ways this is tested on KCNA
These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.
Variation 1. Which kubectl command is used to apply a manifest file to create or update resources?
medium- A.kubectl update -f manifest.yaml
- B.kubectl run -f manifest.yaml
- ✓ C.kubectl apply -f manifest.yaml
- D.kubectl create -f manifest.yaml
Why C: `kubectl apply -f manifest.yaml` is the declarative management command that creates or updates resources by applying a configuration manifest. It uses a three-way merge algorithm to compute the changes needed to reconcile the desired state in the manifest with the current state in the cluster, making it suitable for both initial creation and subsequent updates.
Variation 2. What is the primary purpose of the `kubectl apply` command?
easy- ✓ A.To create or update resources from a manifest
- B.To view resource details
- C.To delete resources
- D.To execute commands inside a container
Why A: The `kubectl apply` command uses a declarative approach to manage Kubernetes resources. It sends a PATCH request to the API server, which compares the desired state in the provided manifest (YAML/JSON) with the current state of the resource in the cluster. If the resource does not exist, it creates it; if it does exist, it updates only the fields specified in the manifest, preserving any fields not mentioned.
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
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.