Created
July 25, 2024 14:47
-
-
Save axeal/cdefb6d5959fb91bca5797a6a02f7cb6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TS=`date -u +"%Y-%m-%d_%H%M"` | |
pprofs=( goroutine heap threadcreate block mutex ) | |
for pod in $(kubectl -n cattle-system get pods --no-headers -l app=rancher -o custom-columns=":.metadata.name"); do | |
echo "getting profile for $pod..." | |
for pp in ${pprofs[@]}; do | |
echo "--> generating $pp..." | |
kubectl -n cattle-system exec $pod -c rancher -- curl -s http://localhost:6060/debug/pprof/$pp -o $pp | |
done | |
echo "--> taring it up..." | |
kubectl -n cattle-system exec $pod -c rancher -- tar -czf debug-pprof.tar.gz $pprofs | |
kubectl -n cattle-system cp -c rancher $pod:debug-pprof.tar.gz $pod-debug-pprof-$TS.tar.gz | |
echo saved debug profile $pod-debug-pprof-$TS.tar.gz | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment