ingress-nginx: Ingress controller fails to reach a single Nginx service exposing 2 ports

Hello,

I have a service which exposes:

  • /foo on port 5611
  • /bar on port 5612

I 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.

Note: similar issue at https://github.com/kubernetes/ingress-nginx/issues/1655

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 6
  • Comments: 21 (6 by maintainers)

Most upvoted comments

IMHO, there is still a defect in here…