Expose existing and deployed Kubernetes service via LoadBalancer Expose existing and deployed Kubernetes service via LoadBalancer kubernetes kubernetes

Expose existing and deployed Kubernetes service via LoadBalancer


The type of the service that you have created is ClusterIP which is not visible outside the cluster. If you edit the service and change the type field to either NodePort, or LoadBalancer, it would expose it.

Documentation on what those service types are and what they mean is at:http://kubernetes.io/docs/user-guide/services/#publishing-services---service-types


In addition to Anirudh answer(right answer)... take into account the following.

Valid values for the ServiceType field are:

  • ClusterIP: use a cluster-internal IP only - this is the default and is discussed above. Choosing this value means that you want this service to be reachable only from inside of the cluster.

  • NodePort: on top of having a cluster-internal IP, expose the service on a port on each node of the cluster (the same port on each node). You’ll be able to contact the service on any :NodePort address.This means that you will forward the node port to the container port which is exposed.Problem, those ports should be externally reachable on every node in the cluster.

  • LoadBalancer: on top of having a cluster-internal IP and exposing service on a NodePort also, ask the cloud provider for a load balancer which forwards to the Service exposed as a :NodePort for each NodeLoadBalancer type creates an external load balancer on the cloud provider.

    Support for external load balancers varies by provider as does the implementation. GCE and AWS are supported (not sure if there is other cloud provider support by now) but if you want to install it in your own infrastructure you will need to install a HAPROXY or ngnix container(or similar) to balance your traffic, this feature doesn't suit to you.