Thursday, June 25, 2020

How to check a port is open or not in pod

In kubenetes cluster, sometimes we may force to debug. It may be related networking, checking open ports, API availability etc.


So here is the simplest way to do this,


1. Create another pod for debugging

kubectl run curl1 --image=radial/busyboxplus:curl -i --tty -n YOUR_NAMESPACE
This will create a new pod in the specified name space and it will enable a command line for typing any command supported by linux

If you don't see a command prompt, try pressing enter.
[ root@curl1-5955d6546b-p5pm2:/ ]$ 

telnet will be enabled by default 

So you can try to telnet to your service which is running in kubernetes cluster.