-
Notifications
You must be signed in to change notification settings - Fork 8.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to expose multiple ports on the same ingress #1655
Comments
@jonathan-kosgei yes. Please keep in mind that ingress exposes port 80 and 443 to the internet |
@aledbf
Is there a way I specify multiple |
that? |
Is it possible to have them on the same path? |
No. What are you trying to do? |
Expose multiple ports on the same domain eg. expose port 8000 and 8080 on mydomain.com |
@jonathan-kosgei ok, ingress cannot help with that use case. |
Closing. Please reopen if you have more questions |
@jonathan-kosgei I haven't tested this but what about ... 👇 apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: some-app
spec:
rules:
- host: app.example.com
http:
paths:
- backend:
serviceName: myapp
servicePort: 8080
- backend:
serviceName: myapp
servicePort: 8081 ... did you try that? |
@itskingori that example will not work. The ingress spec do not allows multiple backends for the same path |
Hello, I have a service which exposes:
I want the Ingress controller to load-balance both endpoint. I have tried this,
and this:
And both fails...
When I try to access When I try to access If I remove basic auth, then, accessing If I change the service type of The problem clearly comes from the Ingress controller. Shouldn't this be considered as defect of the Ingress controller? Thanks. |
Created #2008 for my previous comment. |
It seems that ingress controller does not support multiple ports under the same host. kubernetes/ingress-nginx#1655
it works for apiVersion: networking.k8s.io/v1beta1 k8s v1.18.14 |
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. |
Does this way of providing 2 backend service works? |
Having the same problem over here |
We need to separate HTTP and HTTPS traffic and send them into tenant clusters. Currently traffic was sending only on HTTPS port, this PR enables HTTP traffic forwarding. Nginx ingress does not support setting correct upstream according to type of traffic (http or https) There are set of issues in upstream. - kubernetes/ingress-nginx#1655 - kubernetes/ingress-nginx#9061 - kubernetes/ingress-nginx#11334 Good to know that we found reliable workaround fixes: #209 (comment)
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: apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
annotations:
nginx.ingress.kubernetes.io/backend-protocol: AUTO_HTTP
nginx.ingress.kubernetes.io/configuration-snippet: |
if ($scheme = http) {
set $proxy_upstream_name "mynamespace-myservice-80";
set $proxy_host $proxy_upstream_name;
set $service_port 80;
}
nginx.ingress.kubernetes.io/ssl-passthrough: "true"
nginx.ingress.kubernetes.io/ssl-redirect: "false"
labels:
app.kubernetes.io/managed-by: Helm
name: myservice
namespace: mynamespace
spec:
ingressClassName: mynamespace
rules:
- host: example.org
http:
paths:
- backend:
service:
name: myservice
port:
number: 443
path: /
pathType: ImplementationSpecific
- backend:
service:
name: myservice
port:
number: 80
path: /
pathType: ImplementationSpecific |
I have a service with two ports exposed on ports 8000 and 8080, is it possible to expose them on the same ingress?
The text was updated successfully, but these errors were encountered: