在我的 Kubernetes 环境中,我关注正在运行的 pod
NAME READY STATUS RESTARTS AGE IP NODE
httpd-6cc5cff4f6-5j2p2 1/1 Running 0 1h 172.16.44.12 node01
tomcat-68ccbb7d9d-c2n5m 1/1 Running 0 45m 172.16.44.13 node02
一个是Tomcat实例,另一个是Apache实例。
来自
node01
和 node02
我可以 curl 使用端口 80
的 httpd .但是如果我 curl 在 node2
上运行的 tomcat 服务器来自 node1
它失败。我得到低于输出。[root@node1~]# curl -v 172.16.44.13:8080
* About to connect() to 172.16.44.13 port 8080 (#0)
* Trying 172.16.44.13...
* Connected to 172.16.44.13 (172.16.44.13) port 8080 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.29.0
> Host: 172.16.44.13:8080
> Accept: */*
>
^C
[root@node1~]# wget -v 172.16.44.13:8080
--2019-01-16 12:00:21-- http://172.16.44.13:8080/
Connecting to 172.16.44.13:8080... connected.
HTTP request sent, awaiting response...
但是我可以 telnet 到端口
8080
在 172.16.44.13
来自 node1
[root@node1~]# telnet 172.16.44.13 8080
Trying 172.16.44.13...
Connected to 172.16.44.13.
Escape character is '^]'.
^]
telnet>
这种行为有什么原因吗?为什么我可以远程登录但无法获取网络内容?我也尝试过不同的端口,但 curl 仅适用于端口 80。
最佳答案
我可以通过禁用 selinux
来解决这个问题在我的节点上。
关于Kubernetes 可以 telnet 进入 POD,但不能 curl 网页内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54211595/