【问题标题】:Kubernetes can telnet into POD but can't curl web contentKubernetes 可以 telnet 进入 POD 但不能 curl 网页内容
【发布时间】:2019-01-16 17:59:31
【问题描述】:

在我的 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 实例。

来自 node01node02 我可以 curl 使用端口 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>

这种行为有什么原因吗?为什么我可以远程登录但无法获取网页内容?我也尝试过不同的端口,但 curl 仅适用于端口 80。

【问题讨论】:

  • 你能用kubectl describe pod tomcat-68ccbb7d9d-c2n5m检查tomcat端口吗
  • @edbighead- 我可以通过在我的节点上禁用 selinux 来解决这个问题。
  • @edbighead - 我可以通过在我的节点上禁用 selinux 来解决这个问题。

标签: kubernetes kubectl


【解决方案1】:

我可以通过在我的节点上禁用 selinux 来解决此问题。

【讨论】:

    猜你喜欢
    • 2023-02-25
    • 1970-01-01
    • 2019-09-22
    • 2022-11-19
    • 1970-01-01
    • 1970-01-01
    • 2012-12-29
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多