Tuesday, May 02, 2017

Find public IP of each instance and container pod in Google Cloud Platform

for line in $(gcloud compute instances list | \
grep -v NAME | awk '{print $1}'); \
do echo $line; (gcloud compute ssh $line -- curl -s ifconfig.co); \
done &&
for line in $(kubectl get pods | \
grep -v NAME | awk '{print $1}'); \
do echo $line; (kubectl exec -ti $line -- curl -s ifconfig.co); \
done

No comments:

Followers