300-910 · Question #114
What is used by Kubernetes for access on the matching pods?
The correct answer is D. targetPort. In a Kubernetes Service definition, targetPort specifies the port on the pod's container that the Service proxy forwards traffic to when accessing matching pods.
Question
Exhibit
Options
- AvirtualPort
- Bport
- CNodePort
- DtargetPort
How the community answered
(23 responses)- B4% (1)
- D96% (22)
Why each option
In a Kubernetes Service definition, targetPort specifies the port on the pod's container that the Service proxy forwards traffic to when accessing matching pods.
virtualPort is not a valid Kubernetes Service field and does not exist in the Kubernetes API specification.
The port field defines the port on the Service itself (the ClusterIP) that clients connect to, not the port on the pod container receiving the traffic.
NodePort is a Service type and field that exposes the Service on a static port on each node's external IP, not the port used to access the matching pod's container.
The targetPort field in a Kubernetes Service spec identifies the specific port on the backing pods where the application is listening, and kube-proxy uses this value to route incoming connections from the Service's clusterIP port directly to the correct container port on each matching pod.
Concept tested: Kubernetes Service targetPort pod access configuration
Source: https://kubernetes.io/docs/concepts/services-networking/service/#defining-a-service
Topics
Community Discussion
No community discussion yet for this question.
