Skip to content

Instantly share code, notes, and snippets.

@lightcode
Created June 6, 2017 15:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lightcode/3b970fab0ebca3502b7493c4cb23931e to your computer and use it in GitHub Desktop.
Save lightcode/3b970fab0ebca3502b7493c4cb23931e to your computer and use it in GitHub Desktop.
Check if pods receive pings
#!/bin/bash
PATH="$PATH:/usr/local/bin"
kubectl get po --all-namespaces -o wide | head -n 1
for ip in $(kubectl get po --all-namespaces -o "jsonpath={.items[*].status.podIP }"); do
ping -c 1 -W 3 $ip > /dev/null
[[ $? -gt 0 ]] && kubectl get po --all-namespaces -o wide | awk '$7 == "'$ip'" { print $0 }'
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment