I am following this official k8 ingress tutorial. However I am not able to curl
the minikube IP address and access the "web" application.
- Started up minikube
- enabled the ingress add-on
- created and exposed the deployment
- I am able to curl after
minikube service web --url
:
Hello, world!
Version: 1.0.0
Hostname: web-79d88c97d6-8z8tc
- I created an ingress, with
kubectl apply -f https://k8s.io/examples/service/networking/example-ingress.yaml
I don't have an external IP - just "localhost".
NGG282 kubernetes-ingress % kubectl get ingress
NAME CLASS HOSTS ADDRESS PORTS AGE
example-ingress nginx * localhost 80 66m
This seems to be normal with minikube. However, after creating the ingress with the below yaml, and trying to curl the minikube IP:
curl $(minikube ip)
curl: (7) Failed to connect to 192.168.49.2 port 80: Operation timed out
Any help? Below my Ingress yaml.
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: example-ingress
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /$1
spec:
rules:
- host: hello-world.info
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: web
port:
number: 8080
CodePudding user response:
check your service port section with the port in your deployment, I'm sure you messed something there.
CodePudding user response:
You need to setup your /etc/hosts, I guess the ingress controller wait for requests with an host defined to redirect them, but it's pretty strange that it didn't even respond to the http request with an error.
Could you show what these commands returns ?
kubectl get deploy -n ingress-nginx -o yaml # only the ports section
kubectl get svc -n ingress-nginx -o yaml