You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 24, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Mar 24, 2026. It is now read-only.
How to expose multiple ports on the same ingress #1655
I have a service with two ports exposed on ports 8000 and 8080, is it possible to expose them on the same ingress?
Reacted by Felix Meyer-Wolters, Chiranga Alwis, Andrei Simionescu, Kevin Pullin, Ahsan Shafiq, M00nF1sh, Tomek Święcicki, Jake Shasteen, Samuel Ainsworth, lexasaurus and 28 more
Reacted by Andreas Sommer, Ján Dzurek, Jonny Dixon, Mahmoud Ali, shiningbridge, idaned, João Luiz Castro Naufel, Riedl Kevin, Bsc., Ovidiu Alexa, Majid Q. and 13 more
Expose multiple ports on the same domain eg. expose port 8000 and 8080 on mydomain.com
Reacted by Santiago de Pedro, Ján Dzurek, pito-svk, Juan Pablo Molina Matute, Nick Dat Le, tudordumitriu, Ovidiu Alexa, Majid Q., Matt Fenwick, Federico Paganetto and 10 more
Reacted by Samuel Denis-D'Ortun, Joaquín Menchaca, Tanvir Rahman, Fernando Pérez, asierga95, hassansaadfr, Ananthu Ramachandran Vineetha, m-lamour, Aleksei Komrakov, nieyraud and 65 more
@itskingori that example will not work. The ingress spec do not allows multiple backends for the same path
Reacted by King'ori Maina, Harshal Shah, 风雪夜归人, Hemanth kumar, Andrei Simionescu, Thomas, Aman Mehrotra, Farkhod Sadykov, Samuel Denis-D'Ortun, Mike Staub and 15 more
my-service is properly exposing /foo on port 5611 and /bar on port 5612, each of them being assigned a different .htaccess file for basic authentication.
When I try to access /foo, everything works fine
When I try to access /bar, the login challenge is the one from /foo.
If I remove basic auth, then, accessing /foo still works as expected while accessing /bar from the Ingress URL leads to HTTP 404.
If I change the service type of my-service from ClusterIP to NodePort in order to access it directly (without Ingress), then both endpoints are working as expected (with and without basic auth).
The problem clearly comes from the Ingress controller.
Shouldn't this be considered as defect of the Ingress controller?
Mapping port 80 to port 80 and port 443 to port 443 is vital for hosting public websites that use mixed urls but amazingly it seems that ingress-nginx does not support that simple use case.
Hey there, I was solving this problem for Cozystack, as we were needed to redirect traffic from infra-ingress-controller to user clusters. So, this rule works with no troubles:
Activity
aledbf commentedon Nov 6, 2017
@jonathan-kosgei yes. Please keep in mind that ingress exposes port 80 and 443 to the internet
jonathan-kosgei commentedon Nov 6, 2017
@aledbf
Thanks for the reply. Okay, I have this
Is there a way I specify multiple
servicePorts?aledbf commentedon Nov 6, 2017
that?
jonathan-kosgei commentedon Nov 6, 2017
Is it possible to have them on the same path?
aledbf commentedon Nov 6, 2017
No.
What are you trying to do?
jonathan-kosgei commentedon Nov 6, 2017
Expose multiple ports on the same domain eg. expose port 8000 and 8080 on mydomain.com
aledbf commentedon Nov 6, 2017
@jonathan-kosgei ok, ingress cannot help with that use case.
aledbf commentedon Nov 12, 2017
Closing. Please reopen if you have more questions
itskingori commentedon Dec 25, 2017
@jonathan-kosgei I haven't tested this but what about ... 👇
... did you try that?
aledbf commentedon Dec 25, 2017
@itskingori that example will not work. The ingress spec do not allows multiple backends for the same path
JulienCarnec commentedon Jan 29, 2018
Hello,
I have a service which exposes:
/fooon port 5611/baron port 5612I want the Ingress controller to load-balance both endpoint.
I have tried this,
and this:
And both fails...
my-serviceis properly exposing/fooon port 5611 and/baron port 5612, each of them being assigned a different .htaccess file for basic authentication.When I try to access
/foo, everything works fineWhen I try to access
/bar, the login challenge is the one from/foo.If I remove basic auth, then, accessing
/foostill works as expected while accessing/barfrom the Ingress URL leads to HTTP 404.If I change the service type of
my-servicefrom ClusterIP to NodePort in order to access it directly (without Ingress), then both endpoints are working as expected (with and without basic auth).The problem clearly comes from the Ingress controller.
Shouldn't this be considered as defect of the Ingress controller?
Thanks.
JulienCarnec commentedon Jan 31, 2018
Created #2008 for my previous comment.
fix(ingress): remove port path
dmytropetryk commentedon Mar 5, 2021
it works for apiVersion: networking.k8s.io/v1beta1 k8s v1.18.14
codebard commentedon Sep 18, 2022
Mapping port 80 to port 80 and port 443 to port 443 is vital for hosting public websites that use mixed urls but amazingly it seems that ingress-nginx does not support that simple use case.
a-imran99 commentedon Oct 14, 2022
Does this way of providing 2 backend service works?
Leonardo-Ferreira commentedon Apr 30, 2024
Having the same problem over here
ingress forward both 80 and 443 ports to tenant clusters (#235)
kvaps commentedon Jul 26, 2024
Hey there, I was solving this problem for Cozystack, as we were needed to redirect traffic from infra-ingress-controller to user clusters. So, this rule works with no troubles: