I am playing around with my own small Kubernetes cluster.
Something that I don't understand so far is how to see all open ports (= everything my Pods are listening on).
I use Traefik as ingress with hostPorts :80 and :443 and I can see it listening to :80 and :443 when I run sudo lsof -i
.
However, I also have GitLab running as Pod, and assigned it a hostPort (54321) that points to the Pods' port :22. I use this for git cloning.
Both Pods have a nodeSelector to run only on the master (...yes, I know.).
GitLab's hostPort :54321 doesn't show up with sudo lsof -i
. Why is that?
I can't really explain that with my limited knowledge.
In terms of configuration, the only difference of the Traefik Pods vs. the Gitlab Pod is that for Traefik, the hostPorts point to the same port in the Pod (:80->:80, :443->:443) while for the Gitlab Pod, they differ (:54321->:22).
Can anybody explain this to me? Why can't I trust lsof in this case?
Thanks in advance!
ps. the port is definitely open and listening