Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/bin/bash -x
#
# 1. run as `$0 get-nodes a`
# 2. pick one node and `kubectl describe node ...`
# 3. pick a pod and run `$0 connection <namespace> <pod_name>`
case $1 in
get-nodes)
# second param is AV zone = a/b/c
kubectl get node -l failure-domain.beta.kubernetes.io/zone=ap-southeast-1${2},nodetype=interactive
;;
connection)
# second param=namespace, third param=pod_name
kubectl -n ${2} exec -it ${3} -- /bin/bash -c "apt-get update; \
apt-get install -y telnet net-tools traceroute; echo; \
echo '$ curl https://api.myip.com/'; \
curl https://api.myip.com/; echo; echo; \
echo '$ nc -vznw3 118.97.213.210 443'; \
nc -vznw3 118.97.213.210 443; echo; \
echo '$ telnet 118.97.213.210 443'; \
telnet 118.97.213.210 443; echo; \
echo '$ traceroute 118.97.213.210'; \
traceroute 118.97.213.210
"
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.