简体   繁体   中英

Minikube documentation on how to setup an ingress in Kubernetes doesn't work

I checked the previous question about this topic: Minikube with ingress example not working
But it doesn't solve my issue, since the solution doesn't work with newer version of Kube.netes . Version 1.22

  • The command I used:
# Setup minikube
minikube start
minikube addons enable ingress

# Create the Deployment and Service
kubectl create deployment web --image=gcr.io/google-samples/hello-app:1.0;
kubectl expose deployment web --type=NodePort --port=8080;

# Create the Ingress
kubectl apply -f https://k8s.io/examples/service/networking/example-ingress.yaml;

Since I am using Minikube in local, I have to add the ip from minikube ip in the etc/hosts , which I did.


CHECKING:

❯ kubectl get all
NAME                       READY   STATUS    RESTARTS   AGE
pod/web-79d88c97d6-zfhgh   1/1     Running   0          24m

NAME                 TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)          AGE
service/kubernetes   ClusterIP   10.96.0.1      <none>        443/TCP          25m
service/web          NodePort    10.97.138.67   <none>        8080:31460/TCP   24m

NAME                  READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/web   1/1     1            1           24m

NAME                             DESIRED   CURRENT   READY   AGE
replicaset.apps/web-79d88c97d6   1         1         1       24m

We have the Pod , the Service , the Deployment and the RepicaSet .✅

❯ kubectl get ingress
NAME              CLASS   HOSTS              ADDRESS        PORTS   AGE
example-ingress   nginx   hello-world.info   192.168.49.2   80      24m

The Ingress is okay, the address is indeed the Minikube IP. ✅

❯ cat /etc/hosts
# This file was automatically generated by WSL. To stop automatic generation of this file, add the following entry to /etc/wsl.conf:
# [network]
# generateHosts = false
127.0.0.1       localhost
127.0.1.1       DESKTOP-B4JM855.localdomain     DESKTOP-B4JM855

192.168.1.12    host.docker.internal
192.168.1.12    gateway.docker.internal
127.0.0.1       kubernetes.docker.internal
192.168.49.2    hello-world.info        # <----------- What we care about ✅ 

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

Everything should be correct but, I can't curl to the Ingress with:

curl http://hello-world.info

I do not know if using WSL is causing this issue, but it shouldn't be.

Well, I tried coupal of things but none of them worked out well with docker driver

As of now, there is a going issue with ingress doesn't work on docker desktop kube.netes

So you can't run ingress on local as of now with docker Driver . But you can try out this on AWS/IBM/GCP cloud and clear your task link .

Alternatively, you can try with hyperkit driver like

minikube start --vm=true --driver=hyperkit
  • Or Public Cloud (I tried and it worked) will be good choice to get it done fast.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM