Reputation: 21
i got really confused since i am new to kubernetes is there any difference between kubernetes endpoint and ClusterIP ?
Upvotes: 2
Views: 2822
Reputation: 51
An Endpoint in Kubernetes is just an IP address and port tied to some resource, and you rarely want to think about them at all as they are just used by other resources like Services. It is though a Kubernetes resource that can be found, listed and described.
You can list all Endpoint resources in the cluster with kubectl get endpoints -A
A ClusterIP on the other hand is just an IP address on the internal Kubernetes network. This is where all pods communicate with each other through Services.
A Service is a way for network traffic to flow to pods. If you want to expose a pod only on the internal network for other pods to communicate with you would setup a Service with the type ClusterIP, and use the name of the service as a DNS name. Inside pods on the network you can always call the service names in stead of the actual IP addresses.
If you want the pods to be exposed external to the Kubernets cluster you have multiple ways to do this. You can create a Service with type NodePort which will open the same port on all cluster nodes and direct traffic to the pod through that port. You could also setup a Service with type LoadBalancer, but it is a little more complicated depending on where your cluster is living.
Upvotes: 2