AlexsJones / kubernetes-nifi-cluster

Apache Nifi cluster running in kubernetes
MIT License
84 stars 21 forks source link

does nifi port forwarding work? #17

Closed janitha09 closed 5 years ago

janitha09 commented 5 years ago

Hi

CONTAINER ID        IMAGE                        COMMAND                  CREATED             STATUS                        PORTS                                            NAMES
590151b72adc        apache/nifi                  "../scripts/start.sh"    10 minutes ago      Up 10 minutes                 8443/tcp, 10000/tcp, 0.0.0.0:38080->8080/tcp     some-nifi
$ wget localhost:38080
--2019-07-17 00:24:56--  http://localhost:38080/
Resolving localhost (localhost)... 127.0.0.1
Connecting to localhost (localhost)|127.0.0.1|:38080... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1058 (1.0K) [text/html]
Saving to: ‘index.html.1’

index.html.1                                                         100%[======================================================================================================================================================================>]   1.03K  --.-KB/s    in 0s

2019-07-17 00:24:57 (130 MB/s) - ‘index.html.1’ saved [1058/1058]
sudo docker inspect --format {{.State.Pid}} 590151b72adc
14210
sudo /usr/bin/nsenter -t 14210 --mount --uts --ipc --net --pid
root@590151b72adc:/# netstat -tunlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 127.0.0.1:36943         0.0.0.0:*               LISTEN      28/java
tcp        0      0 172.17.0.5:8080         0.0.0.0:*               LISTEN      60/java
tcp        0      0 0.0.0.0:10000           0.0.0.0:*               LISTEN      60/java
tcp        0      0 127.0.0.1:36795         0.0.0.0:*               LISTEN      60/java
sudo /usr/bin/nsenter -t 14210 -n /usr/bin/socat - TCP4:localhost:8080
2019/07/17 00:06:40 socat[27444] E connect(5, AF=2 127.0.0.1:8080, 16): Connection refused

from kubernetes I am not able to portforward to localhost (wget inside the container works wget :8080)

kubectl port-forward pod/janitha-nifi-59fbf877ff-pbw4c 18080:8080 --address 0.0.0.0 &

from the kubelet log

E0716 23:21:40.053960   14009 httpstream.go:251] error forwarding port 8080 to pod 69f329074ba848fc6b8fd572b31069ce9b6c7e10b1f7d2db9184d9fde8d7d682, uid : exit status 1: 2019/07/16 23:21:40 socat[21287] E connect(5, AF=2 127.0.0.1:8080, 16): Connection refused

I guess my working theory runs something a long the lines of too many processes running inside nifi

I can do this for nginx though

root@532268c992c8:/# netstat -tunlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      1/nginx: master pro
$ sudo /usr/bin/nsenter -t 4900 -n /usr/bin/socat - TCP4:localhost:80
wget
HTTP/1.1 400 Bad Request
Server: nginx/1.17.1
Date: Tue, 16 Jul 2019 23:49:41 GMT
Content-Type: text/html
Content-Length: 157
Connection: close

<html>
<head><title>400 Bad Request</title></head>
<body>
<center><h1>400 Bad Request</h1></center>
<hr><center>nginx/1.17.1</center>
</body>
</html>
AlexsJones commented 5 years ago

I've updated the readme to show how you should be port forwarding