Certified Kubernetes Application Developer (CKAD) Practice Test

Disable ads (and more) with a membership for a one time $2.99 payment

Prepare for the Certified Kubernetes Application Developer (CKAD) Exam. Gain confidence with flashcards and multiple-choice questions, complete with hints and explanations. Achieve your certification with ease!

Each practice test/flash card set has 50 randomly selected questions from a bank of over 500. You'll get a new set of questions each time!

Practice this question and more.


Which component of a NodePort service is used to select a pod using key-value pairs?

  1. spec

  2. ports

  3. selector

  4. nodePort

The correct answer is: selector

The component of a NodePort service that is used to select a pod based on key-value pairs is the selector. The selector plays a critical role in the functionality of the service by indicating which pods the service should route traffic to—this selection is made based on the labels assigned to the pods. In Kubernetes, when you create a service, you define a selector that helps the service identify the appropriate pods. This is typically done using labels, which are key-value pairs that can be attached to Kubernetes objects, including pods. The selector matches the labels on the pods that it should target, ensuring that the service sends requests only to the right pods that meet the specified criteria. While the spec defines the specifications for the service as a whole and includes various configurations, and the ports define the network ports that the service will listen on, it is the selector that directly interacts with the labels on the pods. The nodePort field specifically defines the port that the service will expose on each Node in the cluster, but it also relies on the selector to function properly by directing traffic to the correct pods. Thus, the selector is the essential component that connects the service to the designated pods via their labels, ensuring effective routing and communication within the Kubernetes cluster.