CKA Storage Practice Question
Which of the following is a valid command to create a PersistentVolume named 'pv-demo' using a YAML manifest file named 'pv.yaml'?
⚠ Common exam trap
Test-takers frequently confuse the `kubectl create` subcommand syntax, thinking that `kubectl create pv` or `kubectl create persistentvolume -f` are valid, when in fact `kubectl apply -f` is the correct and most common way to create resources from a manifest file.
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 pv.yaml
`kubectl apply -f pv.yaml` is the standard Kubernetes command to create or update resources from a YAML manifest file. It reads the manifest, which defines a PersistentVolume named 'pv-demo', and sends it to the API server for creation. This command works for any resource type defined in the file, including PersistentVolumes.
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 pv -f pv.yaml
Why it's wrong here
While 'pv' is a valid short name for a PersistentVolume resource, 'kubectl create' does not support a direct 'pv' subcommand. Attempting to execute this command will result in an error because the CLI expects either a generic '-f' flag directly after 'create' or a supported subcommand like 'deployment' or 'service'.
- ✓
kubectl apply -f pv.yaml
Why this is correct
This is the correct and standard declarative command to create or update Kubernetes resources, including PersistentVolumes, from a local or remote YAML manifest. It submits the configuration to the Kubernetes API server, which then provisions or updates the resource state accordingly.
- ✗
kubectl create persistentvolume -f pv.yaml
Why it's wrong here
The 'kubectl create' command does not have a built-in generator subcommand for 'persistentvolume' or 'persistentvolumes'. To create a PersistentVolume using a YAML file, you must pass the file directly to the generic creation command using 'kubectl create -f pv.yaml' instead of specifying the resource type as a subcommand.
- ✗
kubectl run pv-demo --image=pv --restart=Never
Why it's wrong here
This command uses the 'kubectl run' generator to instantiate a single Pod named 'pv-demo' running an image named 'pv'. It does not interact with the PersistentVolume subsystem or provision any storage resources, making it completely irrelevant to creating a PV.
Go deeper
Related to this question
Learn chapter
Installing Kubernetes with kubeadm
Key term
kubectl Command Reference
kubectl is the command-line tool used to interact with and manage Kubernetes clusters by sending commands to the Kubernetes API.
Key term
Volumes
In Kubernetes, a volume is a storage resource that outlives the pod it belongs to, enabling data to persist across container restarts and be shared between containers in the same pod.
About these practice questions
This CKA question is part of Courseiva's 726-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 →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This CKA 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 CKA exam.