I have setup nginx in docker in local system and connected it with application running in minikube for least connection algo load balancing , while hardcoidng the minikube ip and nodeports, LB is working fine, but what if in future, so many pods are automatically added in minikube so, I want to remove dependency of manually updating the nginx.conf for added pods ip and nodeport, how can I achieve that for automatic nginx conf generation for minikube.
Your question is rather a Kubernetes than a Docker question.
What you describe sounds almost exactly like what Kubernetes ingress controllers do:
Once you deployed an ingress controller, you need to define a service resource, and then an ingress resource.
If you are new to Kubernetes, I can recommend working through this free self-paced training: https://container.training/kube-selfpaced.yml.html
I will move your post to general discussions, as it is neither related to the Docker Engine, nor to Testcontainers.
Hi Hrithikdocker,
It sounds like you’re on the right track with your NGINX setup for load balancing in Minikube. As you mentioned, manually updating nginx.conf
for each new pod can quickly become tedious.
To automate this process, you might want to look into using an Ingress controller, as Meyay suggested. Ingress controllers can dynamically update their configurations based on your services and pods. When you set up an Ingress resource, it will automatically route traffic to the appropriate services without needing to hardcode IPs or ports.
As others mentioned, the best method would be using the Ingress Controller. There are multiple ingress controllers available to use. Its best to evaluate which one is good for your senario. Following is a good comparison about ingress controllers. The most popular and widely used ingress controller is Nginx (GitHub - kubernetes/ingress-nginx: Ingress NGINX Controller for Kubernetes)