Skip to content

Commit 1bc56ef

Browse files
authored
Merge pull request #21 from bakerwater/main
update ingress.md
2 parents 5ce332b + f8faea8 commit 1bc56ef

2 files changed

Lines changed: 25 additions & 1 deletion

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2041,4 +2041,4 @@ minikube dashboard
20412041

20422042
## Star History
20432043

2044-
[![Star History Chart](https://api.star-history.com/svg?repos=guangzhengli/k8s-tutorials&type=Date)](https://star-history.com/#guangzhengli/k8s-tutorials&Date)
2044+
[![Star History Chart](https://api.star-history.com/svg?repos=guangzhengli/k8s-tutorials&type=Date)](https://star-history.com/#guangzhengli/k8s-tutorials&Date)

docs/ingress.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,30 @@ curl http://192.168.59.100/hello
160160
curl 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 http://127.0.0.1:61691/
185+
# (....Thank you for using nginx.....)
186+
```
163187

164188
上面的教程中将所有流量都发送到 Ingress 中,如下图所示:
165189

0 commit comments

Comments
 (0)