0

I am a beginner with k8s and I followed the k8s official docs to create a hello-world ingress, but I can't make it work. First I create a service and just like the tutorial I get:

$ kubectl get service web 

NAME   TYPE       CLUSTER-IP      EXTERNAL-IP   PORT(S)          AGE
web    NodePort   10.100.208.38   <none>        8080:31921/TCP   19m

so, I can access my service via browser:

$ minikube service web

Hello, world!
Version: 1.0.0
Hostname: web-79d88c97d6-xrshs 

So far so good. However, I get stuck in the ingress part. So I create this ingress like the tutorial:

$ kubectl describe ingress example-ingress

Name:             example-ingress
Namespace:        default
Address:          
Default backend:  default-http-backend:80 (<error: endpoints "default-http-backend"  not found>)
Rules:
Host              Path  Backends
----              ----  --------
hello-world.info  
                /   web:8080 (172.17.0.4:8080)
Annotations:        nginx.ingress.kubernetes.io/rewrite-target: /$1
...

and even after configuring /etc/hosts with my minikube ip: 192.168.99.102 hello-world.info, when I curl it or access by the browser I get nginx 404. It's strange that my ingress does not get an address, even after a while. Can anyone point me where the error is ?

PS. I did my research before asking here. I check that my minikube ingress addon is enabled and my ingress-nginx-controller pod is running.

PS2. My minikube version is 1.23 and my kubectl client and server versions are 1.22.1.

Digao
  • 520
  • 8
  • 22
  • 1
    Are you able to show the ingress controller pod logs? – clarj Oct 12 '21 at 12:20
  • ... Neither --kubeconfig nor --master was specified. Using the inClusterConfig. This might not work ... "Ignoring ingress because of error while validating ingress class" ingress="default/example-ingress" error="ingress does not contain a valid IngressClass" ... Failed to update lock: configmaps "ingress-controller-leader" is forbidden: User "system:serviceaccount:ingress-nginx:ingress-nginx" cannot update resource "configmaps" in API group "" in the namespace "ingress-nginx" – Digao Oct 12 '21 at 12:47
  • Can you also do ```kubectl get ingressclass -A```? – clarj Oct 12 '21 at 12:54
  • kubectl get ingressclass -A: "No resources found" – Digao Oct 12 '21 at 12:57
  • 1
    Is it Minikube 1.23.0 you are running? – clarj Oct 12 '21 at 13:09

1 Answers1

2

Seems there is a bug with the Ingress Addon with Minikube 1.23.0, as documented here, which matches the issue you are seeing. ConfigMap issues prevent IngressClass from being generated (usually "nginx" by default) and ingress services won't work.

This issue was fixed in 1.23.1, so updating Minikube should fix your issue.

clarj
  • 1,001
  • 4
  • 14
  • 1
    indeed, there was an issue with the Minikube 1.23.0, and after upgrading the issue was solved. For those who have the same doubt, I followed the link https://stackoverflow.com/questions/57821066/how-to-update-minikube-latest-version – Digao Oct 12 '21 at 13:29