Kubernetes and Cloud Native Associate (KCNA)Kubernetes FundamentalsMedium

A cluster administrator is troubleshooting network connectivity for a web application running in a Kubernetes cluster. The application is exposed via a NodePort Service. They notice that requests to the application are timing out. After checking the Pods, they confirm the application is running correctly within the Pods. Which of the following is the most likely cause of the connectivity issue?

  1. AThe Deployment for the application is scaled to zero replicas.
  2. BThe PersistentVolumeClaim is unbound.
  3. CThe Service selector does not match the Pod labels.
  4. DThe Ingress controller is misconfigured.
Show answer & explanation

Correct answer: C. The Service selector does not match the Pod labels.

A Kubernetes Service uses selectors to identify which Pods it should route traffic to. If the labels on the Pods do not match the labels specified in the Service's selector, the Service will not be able to find any endpoints (Pods) and thus will not route traffic, leading to connectivity issues.

Why the other options are wrong

  • A. If the Deployment was scaled to zero, the Pods wouldn't be running correctly, which contradicts the scenario.
  • B. PersistentVolumeClaims relate to storage, not network connectivity for a running web application.
  • D. Ingress is used for external access, but a NodePort Service provides direct access via node IP and port, so Ingress misconfiguration is less likely to be the primary cause here.

Kubernetes Service Selector

A mechanism used by Kubernetes Services to identify a group of Pods that provide a specific functionality.

  • Based on key-value label pairs assigned to Pods.
  • Allows Services to dynamically route traffic to healthy Pods.
  • Ensures loose coupling between Service definitions and Pod lifecycles.

Memory trick: Services select Pods like a 'selector switch' connects to the right 'power outlet'.

More Kubernetes Fundamentals questions