Question

Ingress always goes to 404

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

Submit an answer


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!

Sign In or Sign Up to Answer

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.

Hello thanks for the reply. Changing the host didn’t help but I tried what you recommended and found few interesting things.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: email-api-deployment
  labels:
    app: email-api
spec:
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
  replicas: 2
  selector:
    matchLabels:
      app: email-api
  template:
    metadata:
      labels:
        app: email-api

This is what my email deployment looks like and the label should be email-api but when I tried

kubectl get pods -l email-api

I have that error message : No resources found in default namespace.

Same when I try to show ingress logs : No resources found in ingress-nginx namespace.

But when I used the describe action.

auth.yeebus-test.online / auth-api-service:80

email.yeebus-test.online / email-api-service:80

And I checked the backends IP addresses were the correct one

This comment has been deleted

    Bobby Iliev
    Site Moderator
    Site Moderator badge
    October 19, 2023

    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

    Try DigitalOcean for free

    Click below to sign up and get $200 of credit to try our products over 60 days!

    Sign up

    Get our biweekly newsletter

    Sign up for Infrastructure as a Newsletter.

    Hollie's Hub for Good

    Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

    Become a contributor

    Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

    Welcome to the developer cloud

    DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

    Learn more
    DigitalOcean Cloud Control Panel