Courseiva
Services and Networking →mediumMultiple Choice

CKA Services and Networking Practice Question

You run `kubectl expose deployment web --port=80 --target-port=8080 --type=NodePort` and the Service is created. What is the effect of this command?

⚠ Common exam trap

Test-takers frequently confuse `--type=NodePort` with `--type=LoadBalancer`, assuming that exposing a Service on a node port automatically provisions a cloud load balancer, or they forget that NodePort Services also include a ClusterIP and are not purely external.

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

✓

It creates a NodePort Service, making the deployment accessible on each node's IP on a high port.

The `kubectl expose deployment web --port=80 --target-port=8080 --type=NodePort` command creates a NodePort Service. This Service exposes the deployment on each node's IP address on a static port (in the range 30000-32767 by default), making it accessible from outside the cluster via `<NodeIP>:<NodePort>`. The `--type=NodePort` flag explicitly overrides the default ClusterIP type, and the Service will also automatically allocate a ClusterIP for internal routing.

Answer analysis

Option-by-option breakdown

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

  • ✓

    It creates a NodePort Service, making the deployment accessible on each node's IP on a high port.

    Why this is correct

    The `kubectl expose deployment web --port=80 --target-port=8080 --type=NodePort` command creates a Service of type NodePort, which allocates a high port (30000–32767) on every cluster node and forwards traffic from that port to port 8080 on the pods selected by the `web` deployment. This satisfies the requirement to expose the deployment externally without a cloud load balancer, using each node’s IP address as the access point.

  • ✗

    It creates a LoadBalancer Service and provisions a cloud load balancer.

    Why it's wrong here

    The command specifies or implies the NodePort service type rather than LoadBalancer. A LoadBalancer Service is a distinct type that requires integration with a cloud provider's API to dynamically provision an external infrastructure load balancer. Since NodePort is used here, no cloud-managed load balancer will be created or billed.

  • ✗

    It creates a ClusterIP Service that is only accessible within the cluster.

    Why it's wrong here

    While ClusterIP is the default service type when no explicit type is provided to the kubectl expose command, this configuration overrides that default by specifying NodePort. A ClusterIP service only allocates an internal virtual IP address that is unreachable from outside the cluster. In contrast, NodePort exposes the service externally by opening a dedicated port on every cluster node.

  • ✗

    It creates an ExternalName Service that maps to an external DNS name.

    Why it's wrong here

    An ExternalName Service is a special service type that maps a Kubernetes service to an external DNS name using a CNAME record. It does not use label selectors to target internal pods or forward traffic to a deployment. Because this command targets the web deployment to expose its pods, it creates a standard routing service rather than a DNS alias.

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 →

How Courseiva writes practice questions · Editorial policy

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.