Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nginx Controller Returns 404 Not Found On Path and Default Backend

I have created a kubernetes cluster using Vagrant. I created a Nginx pod and a Cluster IP service for it. I can curl both the pod and the service getting a successful result. I have now installed an Nginx Ingress Controller from: https://kubernetes.github.io/ingress-nginx/deploy/#bare-metal-clusters and ran the following command: kubectl create ingress nginxingress --rule="/nginx=nginx-service:80" --annotation nginx.ingress.kubernetes.io/rewrite-target=/ --default-backend=nginx-service:80 and they both have been setup correctly as far as I see as there are no errors. But whenever I try to curl the path then it fails, the controller keeps throwing a 404 Not found. Some more information that might help:
services:
enter image description here ingresses:
enter image description here
any help will be greatly appreciated

like image 635
Mikerad Avatar asked Aug 31 '25 22:08

Mikerad


1 Answers

Try adding the ingress class annotation to the ingress configuration. kubernetes.io/ingress.class: "nginx"

use below YAML as reference and try to update the configuration.

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: ingress-myserviceb
  annotations:
    kubernetes.io/ingress.class: "nginx"
spec:
  rules:
  - host: myserviceb.foo.org
    http:
      paths:
      - path: /nginx
        pathType: Prefix
        backend:
          service:
            name: nginx-service
            port:
              number: 80
like image 160
Harsh Manvar Avatar answered Sep 04 '25 03:09

Harsh Manvar