Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what is the use of external IP address with a ClusterIP service type in kubernetes

Tags:

kubernetes

What is the use of external IP address option in kubernetes service when the service is of type ClusterIP

like image 202
Hrishikesh Avatar asked Mar 18 '19 12:03

Hrishikesh


2 Answers

An ExternalIP is just an endpoint through which services can be accessed from outside the cluster, so a ClusterIP type service with an ExternalIP can still be accessed inside the cluster using its service.namespace DNS name, but now it can also be accessed from its external endpoint, too. For instance, you could set the ExternalIP to the IP of one of your k8s nodes, or create an ingress to your cluster on that IP.

like image 54
kellanburket Avatar answered Oct 02 '22 08:10

kellanburket


ClusterIP is the default service type in Kubernetes which allows you to reach your service only within the cluster.

If your service type is set as LoadBalancer or NodePort, ClusterIP is automatically created and LoadBalancer or NodePort service will route to this ClusterIP IP address.

The new external IP addresses are only allocated with LoadBalancer type.

You can also use the node's external IP addresses when you set your service as NodePort. But in this case you will need extra firewall rules for your nodes to allow ingress traffic for your exposed node ports.

like image 41
coolinuxoid Avatar answered Oct 02 '22 07:10

coolinuxoid