DCA · Question #147
The Kubernetes yaml shown below describes a clusterIP service. Is this a correct statement about how this service routes requests? Solution: Traffic sent to the IP of this service on port 8080 will…
The correct answer is A. Yes. For a Kubernetes ClusterIP service configured to use port 8080 and route to targetPort: 80 on pods with label aPP: nginx, traffic to the service IP on 8080 is routed to port 80 of a matching pod.
Question
The Kubernetes yaml shown below describes a clusterIP service. Is this a correct statement about how this service routes requests? Solution: Traffic sent to the IP of this service on port 8080 will be routed to port 80 in a random pod with the label aPP: nginx.
Options
- AYes
- BNo
How the community answered
(47 responses)- A96% (45)
- B4% (2)
Why each option
For a Kubernetes ClusterIP service configured to use port 8080 and route to `targetPort: 80` on pods with label `aPP: nginx`, traffic to the service IP on 8080 is routed to port 80 of a matching pod.
A Kubernetes ClusterIP service acts as a stable virtual IP for backend pods. When configured with `port: 8080` and `targetPort: 80`, it receives traffic on port 8080 at its ClusterIP and then transparently redirects that traffic to port 80 on a randomly selected healthy pod matching its `selector: aPP: nginx`.
This statement accurately describes the core routing mechanism of a Kubernetes ClusterIP service, mapping a service port to a target port on selected pods.
Concept tested: Kubernetes ClusterIP service routing
Source: https://kubernetes.io/docs/concepts/services-networking/service/
Topics
Community Discussion
No community discussion yet for this question.