Questão de Service Configuration #019e3a4f
What is a Service?
A static network mapping from a Pod to a port.
A way to expose an application running on a set of Pods.
The network configuration for a group of Pods.
An NGINX load balancer that gets deployed for an application.
Explicação Oficial / Explicações da Comunidade
A Service in Kubernetes is an abstraction that defines a logical set of Pods and a policy by which to access them. It provides a stable IP address and DNS name for a group of Pods, enabling load balancing and service discovery.
How it Works
Services use label selectors to identify the target Pods. When a Service is created, Kubernetes assigns a virtual IP (ClusterIP) that remains stable even if Pods are restarted or scaled. Traffic to the Service is load-balanced across the selected Pods. Services can also be exposed externally via NodePort, LoadBalancer, or Ingress.
Why the Correct Answer is Right
The correct answer states that a Service is "A way to expose an application running on a set of Pods." This accurately captures the primary purpose: providing a stable endpoint to access a dynamic set of Pods. Services decouple the frontend from the backend, allowing Pods to be replaced without affecting clients.
Why the Incorrect Answers are Wrong
- "A static network mapping from a Pod to a port" is incorrect because a Service is not a static mapping; it dynamically routes traffic to Pods based on labels, and it maps to a set of Pods, not a single Pod.
- "The network configuration for a group of Pods" is too vague; while a Service does involve networking, it is specifically about exposing and accessing Pods, not configuring their internal network settings.
- "An NGINX load balancer that gets deployed for an application" is incorrect because a Service is not an NGINX load balancer; it is a Kubernetes resource that can use various implementations (e.g., iptables, IPVS) to load balance traffic, but it does not deploy NGINX by default.