Report this

What is the reason for this report?

Ingress always goes to 404

Posted on October 18, 2023

I was trying to add an Ingress controler to my K8s cluster by following this guide setup nginx

I did everything until the DNS record point and it always redirects me to 404 not found. I check everything I could check so I really need help please.

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: yeebus-ingress
spec:
  rules:
    - host: auth.yeebus-test.online
      http:
        paths:
          - path: "/"
            pathType: Prefix
            backend:
              service:
                name: auth-api-service
                port:
                  number: 80
    - host: auth.yeebus-test.online
      http:
        paths:
          - path: "/"
            pathType: Prefix
            backend:
              service:
                name: email-api-service
                port:
                  number: 80


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Yesterday I saw that i wrote the same host twice but I changed it.

Hi there,

Did removing the duplicated host help with the 404 errors? And did you apply the changes after you updated the yaml file?

If you are still seeing the issue, a few things that you could check would be:

  1. Check the status of the services to which the Ingress is routing:

    kubectl get svc auth-api-service email-api-service
    

    Make sure that the services have the correct pods selected and are receiving traffic correctly.

  2. Make sure the services have the correct endpoints associated:

    kubectl describe svc auth-api-service email-api-service
    
  3. Check if the pods for your services are running and healthy:

    kubectl get pods -l <your-label-selector>
    
  4. Check the logs of the Nginx Ingress controller to see if there are any issues or helpful messages:

    kubectl logs -l app=nginx-ingress -n <nginx-ingress-namespace>
    
  5. Check that the Ingress Controller itself is running without issues. If using Helm:

    helm list -n <namespace-of-ingress-controller>
    
  6. Describe the Ingress resource to see if there are any annotations or statuses that might give a clue:

    kubectl describe ingress yeebus-ingress
    

Let me know how it goes!

Best,

Bobby

This comment has been deleted

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.