Courseiva
Container OrchestrationmediumMultiple ChoiceObjective-mapped

KCNA Container Orchestration Practice Question

A Kubernetes cluster has a Service named 'my-svc' in the 'default' namespace. Which command would correctly expose this service as an external endpoint using a cloud load balancer?

⚠ Common exam trap

The CNCF exam often tests the misconception that `kubectl expose service` without `--type=LoadBalancer` will automatically expose the service externally, when in fact it only creates a ClusterIP Service unless the type is explicitly specified.

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 expose service my-svc --type=LoadBalancer --name=my-svc-lb

`kubectl expose service my-svc --type=LoadBalancer --name=my-svc-lb` creates a new Service of type LoadBalancer that inherits the selector and port configuration from the existing 'my-svc' Service, which provisions a cloud load balancer (e.g., AWS ELB, GCP TCP/UDP LB) to expose it externally. The `--type=LoadBalancer` flag is essential to request a cloud load balancer, and `--name` specifies the new Service's name to avoid overwriting the original.

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 expose deployment my-svc --type=LoadBalancer --name=my-svc-lb

    Why it's wrong here

    This would attempt to expose a deployment, not the service.

  • kubectl expose service my-svc --name=my-svc-lb

    Why it's wrong here

    Without --type, defaults to ClusterIP, not LoadBalancer.

  • kubectl expose service my-svc --port=80 --target-port=8080

    Why it's wrong here

    This changes port mapping but does not set the service type to LoadBalancer.

  • kubectl expose service my-svc --type=LoadBalancer --name=my-svc-lb

    Why this is correct

    Correctly creates a new LoadBalancer service based on the existing service.

About these practice questions

Courseiva writes every KCNA question from scratch — 833 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 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.