Skip to content

Instantly share code, notes, and snippets.

@puluanau
Created May 28, 2020 09:50
Show Gist options
  • Save puluanau/6705a2cb058336da4404b2c42ddf2ce6 to your computer and use it in GitHub Desktop.
Save puluanau/6705a2cb058336da4404b2c42ddf2ce6 to your computer and use it in GitHub Desktop.
#!/bin/bash
# put this script somewhere and then run it with tee to a file, like so:
# bash this-script.sh 2>&1 | tee /tmp/afile.log
# set this to your namespace
namespace="domino-platform"
function splitit {
echo "----------------------------- START $@"
}
# keys
redispw=$(kubectl get secret -n $namespace redis-ha -o yaml | grep auth: | awk '{print $2}' | base64 --decode)
splitit "Redis keys"
kubectl exec -n $namespace redis-ha-server-0 -c redis -- redis-cli -a $redispw keys '*'
# can find/reach redis...
for i in $(kubectl get po -n $namespace -l 'app.kubernetes.io/component=frontend,app.kubernetes.io/instance=nucleus' --no-headers | awk '{print $1}'); do
splitit "redis check $i "
kubectl exec -n $namespace $i -c nucleus-frontend -- /bin/bash -c 'apt update > /dev/null; apt -y install netcat > /dev/null; cat /etc/resolv.conf; /usr/bin/nslookup redis-ha; /bin/echo "ping" | /bin/nc -w 1 redis-ha 6379'
done
#logs
for i in $(kubectl get po -n $namespace -l 'app.kubernetes.io/component=frontend,app.kubernetes.io/instance=nucleus' --no-headers | awk '{print $1}'); do
splitit "frontend logs $i"
kubectl logs -n $namespace "$i" nucleus-frontend
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment