Kubernetes 101 : Services, deployments and endpoints - Bypassing the ClusterIP service -
Other services like the nodeBalancer or the nodePort, also make use of the clusterIP service to communicate with the pods.
If a service or an application wants to connect directly to the
pods without going through a clusterIP service, they need to use a kubernetes object called endpoints.
pods without going through a clusterIP service, they need to use a kubernetes object called endpoints.
The endpoints:
Endpoints could be described as a group of IP addresses that a service forwards its requests to.
We have for example the below deployment:
The above deployment spawns two replicas "pods" of "nginx".
Displaying the addresses of the two pods:
To see the IP addresses of the above pods, we use the below command:
We also need to create a service to have access to the above "nginx" pods:
We can display our service using the below command:
Displaying the endpoints of our service:
We display the endpoints our "nginx-service" forwards its requests to using the below command:
We could bypass the clusterIP service and directly reach the "nginx" application running inside the pods using the addresses :
Comments