【发布时间】:2023-04-07 18:36:01
【问题描述】:
我有 1 个 Master 和 2 个 Menions。
Master IP: 192.168.20.50
Menion1: 192.168.20.51
Menion2: 192.168.20.52
我能够在 Master 中运行复制容器并创建服务。我在使用主 IP 访问应用程序容器时遇到问题。
我使用 fallowing 命令进行了从 master 到 menion 的端口转发。
[root@master ~]# kubectl port-forward nginx :80 &
[2] 2229
[root@master ~]# I1201 22:15:46.822396 2229 portforward.go:213] Forwarding from 127.0.0.1:43020 -> 80
I1201 22:15:46.822603 2229 portforward.go:213] Forwarding from [::1]:43020 -> 80
所以当我点击 localhost 时,我可以访问 nginx,但是当我点击 Master IP 时,连接被拒绝。
[root@master ~]# curl http://localhost:43020
I1201 22:15:57.031858 2229 portforward.go:247] Handling connection for 43020
<title>Welcome to nginx!</title> <style> body { width: 35em; margin: 0 auto; font-family: Tahoma, Verdana, Arial, sans-serif; } </style>
Welcome to nginx!
如果您看到此页面,则 nginx Web 服务器已成功安装并正在运行。需要进一步配置。
有关在线文档和支持,请参阅 nginx.org。 nginx.com 上提供商业支持。
感谢您使用 nginx。
[root@master ~]# curl http://192.168.1.49:43020
curl: (7) Failed connect to 192.168.1.49:43020; Connection refused
【问题讨论】:
-
您使用的是特定的覆盖网络吗?您的机器是否可通过 IP 转发?
标签: kubernetes