CKAD Services and Networking Practice Question
Which TWO of the following are valid methods to create a Service in Kubernetes? (Select 2)
⚠ Common exam trap
A common trap is that `kubectl run` and `kubectl port-forward` might appear to create a Service but actually do not; only declarative or imperative Service creation commands like `kubectl apply -f`, `kubectl expose`, and `kubectl create service` are valid.
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 service.yaml
`kubectl apply -f service.yaml` declaratively creates a Service from a YAML manifest. Option B is correct because `kubectl expose deployment my-deploy --port=80` imperatively creates a Service that exposes the deployment's pods. Option E is not considered a standard method for creating a Service in the context of this exam; the commonly taught imperative commands are `kubectl apply -f` and `kubectl expose`. Options C and D are incorrect: `kubectl port-forward` does not create a Service, and `kubectl run` creates a Pod or Deployment, not a Service.
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 apply -f service.yaml
Why this is correct
Applying a YAML manifest creates the Service.
- ✓
kubectl expose deployment my-deploy --port=80
Why this is correct
Expose creates a Service from a deployment.
- ✗
kubectl port-forward svc/my-svc 8080:80
Why it's wrong here
Port-forward does not create a Service.
- ✗
kubectl run my-svc --image=nginx --port=80
Why it's wrong here
Run creates a pod, not a Service.
- ✗
kubectl create service clusterip my-svc --tcp=80:80
Why it's wrong here
Create service command is valid.
Go deeper
Related to this question
About these practice questions
Courseiva writes every CKAD question from scratch — 160 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 →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This CKAD 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 CKAD exam.