<p>I created a service and each service is creating a new load balancer, I don't want to create a new load balancer for each service. For that, I found solution ingress controller but it's not happening.</p>

surendar rajasekaran
<p>I will try to describe the objects you need in just words.</p>

<p>You don't need to create a load balancer for each service. When you're using an ingress controller (like nginx), the ingress controller itself will be the type load balancer. All your other services need to be something like ClusterIP type.</p>

<p>Afterwards you can decide how to link your ClusterIP services with the Nginx LoadBalancer: create an ingress for each service or one ingress that exposes each service based on some rule (like paths as @harsh-manvar shows in the post above).</p>

<p>When you say "it's not happening", it would be good if you could provide details on your setup.</p>

<p>In order for Nginx ingress controller to work, it needs to be defined either as a NodePort or LoadBalancer service type. The examples provided in the nginx documentation are using LoadBalancer. However, LoadBalancer only works when your cluster supports this object (that means running in most cloud providers like AWS/GCP/Azure/DigitalOcean or newer versions of minikube). On the other hand, NodePort will expose the ingress controller on the Kubernetes node where it runs (when using minikube, that usually means a VM of sorts which then needs to be port forwarded to be accessible).</p>

<p>To use ingress in a local environment, you can look into minikube. All you need is to run <code>minikube addons enable ingress</code> and it will deploy an nginx controller for you. Afterwards, all you need to do is define an ingress and depending on your setup you may need to use <code>kubectl port-forward</code> to port forward port 80 on an nginx controller pod to a local port on your machine.</p>
