For the first time in my life, I am unable to figure out what process is listening on a specific port in Linux :)
This is an Ubuntu Server 22.04 installation, running K8s. There is an ingress controller in the cluster that is binding to ports 80 and 443, and I know this works because:
:~# curl localhost <html> <head><title>404 Not Found</title></head> <body> <center><h1>404 Not Found</h1></center> <hr><center>nginx</center> </body> </html> :~# curl localhost:443 <html> <head><title>400 The plain HTTP request was sent to HTTPS port</title></head> <body> <center><h1>400 Bad Request</h1></center> <center>The plain HTTP request was sent to HTTPS port</center> <hr><center>nginx</center> </body> </html> ~# curl https://localhost:443 -k <html> <head><title>404 Not Found</title></head> <body> <center><h1>404 Not Found</h1></center> <hr><center>nginx</center> </body> </html> The problem is that I cannot figure out what process binds to those ports, and how. I did try using ss, but nothing shows up:
:~# ss -tlnpu | grep 80 tcp LISTEN 0 4096 192.168.13.191:2380 0.0.0.0:* users:(("etcd",pid=1452,fd=8)) tcp LISTEN 0 4096 127.0.0.1:2380 0.0.0.0:* users:(("etcd",pid=1452,fd=7)) :~# ss -tlnpu | grep 443 tcp LISTEN 0 4096 *:6443 *:* users:(("kube-apiserver",pid=1546,fd=7)) How can I figure out the actual process that is listening on the ports?
localhostresolve to?iptablesrules, particularly thenattables where you will haveDNATrules. Maybe your ports 80 & 443 are being forwarded elsewhere or rewritten to different portssscommand within the appropriate container? The processes managed by Kubernetes (K8s) could be in a separate network namespace, so a host-levelssmight not see them without the-N <namespace>or--net=<namespace>option.iptables, but I didn't think to look at thenattables as well :) . @roaima is right - there areDNATrules rewriting the packets. If you would post that as an answer, I would gladly accept it!