A simple kubectl plugin to collect Go pprof profiles from pods that expose the "net/http/pprof" endpoints on a local port.
The plugin will port-forward to the specified pod and write the pprof profile to the filesystem
to be analyze with go tool pprof
.
- Download the binary from the GH release
- Move the
kubectl-pprof
binary to anywhere in your$PATH
- Run
kubectl pprof -h
to validate the plugin is working
kubectl pprof <pod> --port 8080 -n <namespace> --profile cpu
kubectl pprof <pod> --port 8080 -n <namespace> --profile heap --seconds 30 --output /tmp/
kubectl pprof <pod> --port 8080 -n <namespace> --profile cpu -q | xargs go tool pprof -http=:8080