Kubernetes Service vs Kubernetes Ingress
People think a service and an ingress do the same job, and they do not. A service gives a group of pods one steady address inside the cluster. An ingress lets web traffic in from outside, and sends each site or path to the right service. Traffic from the internet usually passes through both, the ingress first.
Kubernetes Service
A steady name and address for a changing group of pods. It shares traffic among them.
A Kubernetes service gives a group of pods one steady name and address. Pods come and go, and each new one gets a new address. The service keeps track of which pods are alive right now. It picks them by a label, like app: shop. Any request sent to the service is passed on to one of those pods.
Kubernetes Ingress
Rules that let web traffic in. They send each site to the right service.
A Kubernetes ingress lets web traffic from outside reach services inside the cluster. It holds rules, like send shop.example.com to the shop service. The rules do nothing alone. A program called an ingress controller reads them and sends the traffic. It can also handle HTTPS, so one way in serves many sites. The Kubernetes team now says to use Gateway, a newer way, for new work.
In one line
- Kubernetes Service
- A steady name and address for a changing group of pods. It shares traffic among them.
- Kubernetes Ingress
- Rules that let web traffic in. They send each site to the right service.