【发布时间】:2022-01-02 15:20:12
【问题描述】:
我正在尝试在 Minikube 中运行/设置入口。但它没有发生。以下是步骤 环境:
- Windows 10 专业版
- minikube 版本:v1.24.0
已启用入口:
|入口 |迷你库 |启用✅ |未知(第三方) |
|入口-dns |迷你库 |启用✅ |未知(第三方)|
创建部署
$ kubectl get deployment
NAME READY UP-TO-DATE AVAILABLE AGE
deployment.apps/web 1/1 1 1 9s
公开服务
kubectl expose deployment web --type=NodePort --port=8080
$ kubectl get svc
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 38h
web NodePort 10.103.21.35 <none> 8080:30945/TCP 3m22s
启动服务
minikube service web
Browser url: http://127.0.0.1:59188/
Browser content:
Hello, world!
Version: 1.0.0
Hostname: web-79d88c97d6-c79mp
创建入口:
$ kubectl apply -f https://k8s.io/examples/service/networking/example-ingress.yaml
ingress.networking.k8s.io/example-ingress unchanged
$ kubectl get ingress
NAME CLASS HOSTS ADDRESS PORTS AGE
example-ingress nginx hello-world.info localhost 80 14h
添加地图主机:
> in /etc/hosts
> 127.0.0.1 hello-world.info and in windows/system32/etc/hosts
> 127.0.0.1 hello-world.info
运行 curl 命令:(从一个新的 git bash 我执行以下命令)
$ curl hello-world.info
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- 0:00:02 --:--:-- 0
curl: (7) Failed to connect to hello-world.info port 80: Connection refused
在浏览器中:
URL: http://hello-world.info/
Browser content: This site can't be reached
hello-world.info refused to connect.
不知道为什么我会失败。在此处请求帮助。
【问题讨论】:
标签: kubernetes kubernetes-ingress minikube