Grab a kubeconfig file pointing to the fleet-agent downstream cluster, then copypaste:
export KUBECONFIG=/path/to/kubeconfig.yaml
# get pod name
if kubectl get ns | grep cattle-fleet-system; then
export NAMESPACE=cattle-fleet-system
else
export NAMESPACE=fleet-system
fi
export POD=$(kubectl --namespace ${NAMESPACE} get pod --selector='app=fleet-agent' --output jsonpath="{.items[0].metadata.name}")
# forward port 6060 from the fleet-agent pod to localhost
kubectl --namespace $NAMESPACE port-forward pod/$POD 6060:6060 &
# collect 30s worth of profiles and open a browser to analyze them
go tool pprof -http=: "http://localhost:6060/debug/pprof/profile?seconds=30"
Example: