@@ -160,7 +160,32 @@ curl http://192.168.59.100/hello
160160curl http://192.168.59.100/
161161# (....Thank you for using nginx.....)
162162```
163+ 这里和service一样,如果本地使用 Docker Desktop(minikube start --driver=docker)的话,那你大概率无法通过minikube ip获取到的ip地址来请求,你可以先通过` minikube service list ` 来查看服务列表,然后通过` minikube service ingress-nginx-controller -n ingress-nginx --url ` 来公开服务,然后通过` curl ` 或者浏览器来访问。
164+ ``` shell
165+ minikube service list
166+ # |---------------|------------------------------------|--------------|---------------------------|
167+ # | NAMESPACE | NAME | TARGET PORT | URL |
168+ # |---------------|------------------------------------|--------------|---------------------------|
169+ # | default | kubernetes | No node port |
170+ # | default | service-hellok8s-clusterip | No node port |
171+ # | default | service-nginx-clusterip | No node port |
172+ # | ingress-nginx | ingress-nginx-controller | http/80 | http://192.168.49.2:32339 |
173+ # | | | https/443 | http://192.168.49.2:32223 |
174+ # | ingress-nginx | ingress-nginx-controller-admission | No node port |
175+ # | kube-system | kube-dns | No node port |
176+ # |---------------|------------------------------------|--------------|---------------------------|
177+ minikube service ingress-nginx-controller -n ingress-nginx --url
178+ # http://127.0.0.1:61691 http
179+ # http://127.0.0.1:61692 https
180+ # ❗ Because you are using a Docker driver on windows, the terminal needs to be open to run it.
181+ # 第一个是http,第二个是https,这里我们只需要http,所以我们只需要第一个地址
182+ curl http://127.0.0.1:61691/hello
183+ # [v3] Hello, Kubernetes!, From host: hellok8s-deployment-5d5545b69c-sn7mn
184+ curl curl http://127.0.0.1:61691/
185+ # (....Thank you for using nginx.....)
186+ ```
163187
188+ \
164189上面的教程中将所有流量都发送到 Ingress 中,如下图所示:
165190
166191![ ingress] ( https://cdn.jsdelivr.net/gh/guangzhengli/PicURL@master/uPic/ingress.png )
0 commit comments