Kubernetes and Cloud Native Associate (KCNA)Kubernetes FundamentalsMedium

A network engineer wants to expose a web application running in a Kubernetes cluster to external traffic on a specific port (e.g., port 30080) across all worker nodes. Clients should be able to access the application by hitting any worker node's IP address on this designated port. Which Kubernetes Service type is most suitable for this requirement?

  1. ALoadBalancer
  2. BNodePort
  3. CClusterIP
  4. DExternalName
Show answer & explanation

Correct answer: B. NodePort

A NodePort Service exposes an application on a static port on each worker node's IP address. This allows external traffic to directly access the application via any node.

Why the other options are wrong

  • A. LoadBalancer provisions an external load balancer, which might not be available or desired for direct node access.
  • C. ClusterIP exposes the Service only within the cluster, not externally.
  • D. ExternalName maps a Service to an arbitrary external DNS name, not for exposing applications directly on node IPs.

Kubernetes NodePort Service

A NodePort Service exposes a Service on a static port (NodePort) on each Node's IP address. This makes the Service accessible from outside the cluster by requesting `<NodeIP>:<NodePort>`.

  • Makes the service accessible externally.
  • A port is opened on every node in the cluster.
  • The NodePort value is typically in the range 30000-32767.

Memory trick: NodePort Opens Nodes to the Outside

More Kubernetes Fundamentals questions