Run the following commands:
export KUBECONFIG=/path/to/the/downstream_cluster.yaml
while true; do
for pod in $(kubectl get pods -n cattle-system --no-headers -l app=cattle-cluster-agent | cut -d ' ' -f1); do
echo getting heap for $pod
kubectl exec -n cattle-system $pod -- curl -s http://localhost:6060/debug/pprof/heap -o heap
kubectl cp cattle-system/${pod}:heap ./${pod}-heap-$(date +'%Y-%m-%dT%H_%M_%S')
done
sleep 120
done