I have a service with two ports exposed on ports 8000 and 8080, is it possible to expose them on the same ingress?
@jonathan-kosgei yes. Please keep in mind that ingress exposes port 80 and 443 to the internet
@aledbf
Thanks for the reply. Okay, I have this
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: dspace
namespace: testing
annotations:
kubernetes.io/ingress.class: traefik
spec:
rules:
- host: myapp.us.com
http:
paths:
- backend:
serviceName: myapp
servicePort: 8080
Is there a way I specify multiple servicePorts ?
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: dspace
namespace: testing
spec:
rules:
- host: myapp.us.com
http:
paths:
- path: /
backend:
serviceName: myapp
servicePort: 8080
- path: /app-port-2
backend:
serviceName: myapp
servicePort: 8081
that?
Is it possible to have them on the same path?
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:
/foo on port 5611/bar on port 5612I want the Ingress controller to load-balance both endpoint.
I have tried this,
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: my-ingress
spec:
rules:
- host: my.example.com
http:
paths:
- path: /foo
backend:
serviceName: my-service
servicePort: 5611
- path: /bar
backend:
serviceName: my-service
servicePort: 5612
and this:
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: my-ingress
spec:
rules:
- host: my.example.com
http:
paths:
- path: /foo
backend:
serviceName: my-service
servicePort: 5611
- host: my.example.com
http:
paths:
- path: /bar
backend:
serviceName: my-service
servicePort: 5612
And both fails...
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?
Thanks.
Created https://github.com/kubernetes/ingress-nginx/issues/2008 for my previous comment.
Most helpful comment
@itskingori that example will not work. The ingress spec do not allows multiple backends for the same path