The ClusterIP service
We're now going to discover another type of service called ClusterIP
.
ClusterIP
is, in fact, the simplest type of service Kubernetes provides. With a ClusterIP
service, you can expose your Pod so that other Pods in Kubernetes can communicate with it via its IP address or DNS name.
Why do you need ClusterIP services?
The ClusterIP
service type greatly resembles the NodePort
service type, but they have one big difference: NodePort
services are meant to expose Pods to the outside world, whereas ClusterIP
services are meant to expose Pods to other Pods inside the Kubernetes cluster.
Indeed, ClusterIP
services are the services that allow different Pods in the same cluster to communicate with each other through a static interface: the ClusterIP
Service
object itself.
ClusterIP
answers the exact same need for static DNS name or IP address we had with the NodePort
service: if a Pod fails, is recreated, deleted, relaunched, and so on, then Kubernetes...