List All Pod’s IP with a Specific Labels

In OpenShift or plain Kubernetes, we can have a multiple pods for a specific Deployment or DeploymentConfigs. But sometimes we want to know what are the IPs of those pods, lets say for a token refresh or cache refresh purpose.

Listing all pod’s IPs can be achieved by running below command,

$ kubectl get pods --output custom-columns=POD:.status.podIP \
	-l app=your-application-label --no-headers

It will gives a result of something like this,

10.128.6.66
10.128.5.181
10.130.2.12
10.131.7.74

Leave a Comment

Your email address will not be published.