Kubernetes 可以 telnet 到 POD 但不能 curl web 内容
Kubernetes can telnet into POD but can't curl web content
在我的 Kubernetes 环境中,我关注 pods 运行
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
我可以卷曲使用端口 80
的 httpd。但是,如果我从 node1
卷曲运行 在 node2
上的 tomcat 服务器,它会失败。我低于输出。
[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...
但我可以从 node1
telnet 到 172.16.44.13
上的端口 8080
[root@node1~]# telnet 172.16.44.13 8080
Trying 172.16.44.13...
Connected to 172.16.44.13.
Escape character is '^]'.
^]
telnet>
这种行为有什么原因吗?为什么我可以telnet但是无法获取网页内容?我也尝试过不同的端口,但 curl 仅适用于端口 80。
我可以通过在我的节点上禁用 selinux
来解决这个问题。
在我的 Kubernetes 环境中,我关注 pods 运行
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
我可以卷曲使用端口 80
的 httpd。但是,如果我从 node1
卷曲运行 在 node2
上的 tomcat 服务器,它会失败。我低于输出。
[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...
但我可以从 node1
172.16.44.13
上的端口 8080
[root@node1~]# telnet 172.16.44.13 8080
Trying 172.16.44.13...
Connected to 172.16.44.13.
Escape character is '^]'.
^]
telnet>
这种行为有什么原因吗?为什么我可以telnet但是无法获取网页内容?我也尝试过不同的端口,但 curl 仅适用于端口 80。
我可以通过在我的节点上禁用 selinux
来解决这个问题。