Service
What is Service?
Service: A stable network endpoint in front of a set of Pods. Pods come and go, but the Service gives them one steady virtual IP and DNS name. A Service in Kubernetes gives a group of pods one stable address and DNS name. Pods come and go with new IP addresses, but the Service always routes traffic to whichever matching pods are currently healthy.
Frequently asked questions about Service
How is Service used in practice?
It finds its pods with a label selector, and it only sends traffic to pods that pass their readiness probe. Other applications in the cluster simply connect to the Service name, such as web or mysql.
What should you keep in mind with Service?
The default type, ClusterIP, is internal only. NodePort and LoadBalancer types expose a Service outside the cluster, and an Ingress usually handles HTTP traffic from the internet. If a Service does not respond, check kubectl get endpoints for it. An empty list means no pods match the selector or none of them are ready.
What does an example of Service look like?
apiVersion: v1 kind: Service metadata: name: web spec: selector: { app: web } ports: - port: 80 targetPort: 8080 At a glance
| Category | Kubernetes |
|---|---|
| Explained by | Reinier de la Parra |
| Updated |