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
Last active
August 26, 2024 20:35
-
-
Save flrichar/0c508887b51ffa60422f0d41aba67922 to your computer and use it in GitHub Desktop.
Rancher Profile Collection
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment