skip to Main Content

When applying the yaml file to the ingress services a load balancer is created. I pointed my DNS domain to that load balancer IP and it reaches the nginx server. However when routing to https://www.example.com/api/users/ or https://www.example.com/api/users/currentuser/ (or it’s http:// equivalents) it returns a 404 page. Here is the Ingress-Nginx yaml file I’m using:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: ingress-service
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/use-regex: "true"
spec:
  rules:
    - host: www.example.com
      http:
        paths:
          - path: /api/users/
            pathType: Prefix
            backend:
              service:
                name: be-auth-srv
                port:
                  number: 9001
          - path: /auth/
            pathType: Prefix
            backend:
              service:
                name: be-contact-form-srv
                port:
                  number: 9000

Anybody can shed light on this topic? Thanks

2

Answers


  1. Chosen as BEST ANSWER

    Solved by installing ingress-nginx in the AKS environment using yaml file in Azure Powershell. https://kubernetes.github.io/ingress-nginx/deploy/#quick-start


  2. Based on the example you provided, I would suggest, as a test, to update the first path definition to the following:

    • path: /api/users(/|$)(.*)

    …and assuming the Nginx Ingress Controller is already configured to terminate TLS, try reaching https://www.example.com/api/users/

    I would also double check that the be-auth-srv service is configured to listen on port 9001.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search