CKA Services and Networking Practice Question
A developer runs 'kubectl run nginx --image=nginx --expose --port=80'. What Kubernetes resources are created?
⚠ Common exam trap
Many exam-takers assume `kubectl run` always creates a Deployment (as it did in older Kubernetes versions) or that `--expose` creates a LoadBalancer, but the CKA exam tests the current default behavior where `kubectl run` creates a pod and `--expose` creates a ClusterIP service.
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 pod named 'nginx' and a ClusterIP service named 'nginx'
The `kubectl run nginx --image=nginx --expose --port=80` command creates a pod named 'nginx' and automatically generates a ClusterIP service named 'nginx' that exposes port 80. The `--expose` flag triggers the creation of a service of type ClusterIP (the default service type) to provide stable network access to the pod.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Only a pod named 'nginx'
Why it's wrong here
While kubectl run primarily provisions a single Pod, appending the --expose flag instructs Kubernetes to additionally generate an associated Service. This Service is automatically configured to target the newly created Pod's port, meaning the command does not limit its output to just a Pod resource.
- ✓
A pod named 'nginx' and a ClusterIP service named 'nginx'
Why this is correct
Executing kubectl run with the --expose flag creates a Pod and concurrently provisions a ClusterIP Service sharing the exact same name. By default, this Service acts as an internal load balancer, mapping its own port directly to the container port defined in the Pod specification.
- ✗
A pod named 'nginx' and a LoadBalancer service named 'nginx'
Why it's wrong here
The --expose flag defaults to creating a ClusterIP service type for internal cluster communication. To provision a LoadBalancer service, which integrates with cloud provider infrastructure to assign an external IP address, you would need to explicitly define the service type using additional configuration parameters or separate commands.
- ✗
A deployment named 'nginx' and a NodePort service named 'nginx'
Why it's wrong here
Modern versions of Kubernetes restrict the kubectl run command to generating individual Pods rather than Deployments, which are instead created via kubectl create deployment. Furthermore, the --expose flag defaults strictly to a ClusterIP service type rather than exposing the workload on a static port on each node via NodePort.
Go deeper
Related to this question
Learn chapter
Kubernetes Architecture Overview
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
ClusterIP NodePort LoadBalancer
ClusterIP, NodePort, and LoadBalancer are three types of Kubernetes Services that control how traffic reaches your application pods inside the cluster or from outside.
About these practice questions
Courseiva writes every CKA question from scratch — 726 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 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.