Kubernetes can telnet into POD but can't curl web content

1/16/2019

In my Kubernetes environment I have following to pods running

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

One is a Tomcat instance and other one is a Apache instance.

from node01 and node02 I can curl the httpd which is using port 80. But If i curl the tomcat server which is running on node2 from node1 it fails. I get below output.

[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...

But I'm able telnet to port 8080 on 172.16.44.13 from node1

[root@node1~]# telnet 172.16.44.13 8080
Trying 172.16.44.13...
Connected to 172.16.44.13.
Escape character is '^]'.
^]
telnet>

Any reason for this behavior? why am I able to telnet but unable to get the web content? I have also tried different ports but curl is working only for port 80.

-- Chamara Keragala
kubectl
kubernetes

1 Answer

1/16/2019

I was able to get this fixed by disabling selinux on my nodes.

-- Chamara Keragala
Source: StackOverflow