Reputation: 327
I have 9 pods running which are basically 9 different applications.
Is it possible to have same k8s service (LB | Public IP) for multiple pods such that I can access them by different ports, but the same IP of service (LB)?
E.g. like so:
LB-IP:80 -- In the backend an application is running, which I can access.
LB-IP:8080 (Same IP as previous) -- I will run another pod in the backend.
**** Selectors will be different for each pod.**
Upvotes: 9
Views: 11250
Reputation: 22874
As for the pure service approach, no it is not possible. Service relates to only one selector so you can't.
Now, as you talk about LB here, you might be talking about exposing the thing externally, and for that you can have an Ingress/IngressController. If you want, you can also just deploy a "gateway" service that will do the thing for you (ie. HA proxy configured to expose these different ports you want)
If your environment does not support ingress, you might want to deploy ie. Nginx Ingress Controller which does a great job for the point of entry to your services
Upvotes: 6