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:
ingresses:
any help will be greatly appreciated
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With