How to get a goroutine stack dump from KOTS

Sometimes when debugging an issue, we may ask to obtain a goroutine stack dump to examine all the function calls currently on the Go stack. This procedure is usually called for when a process is stuck or hanging. For example, when observing that the Support Bundle taken from the Admin Console is stuck in the “Analyzing” stage and does not progress.

Taking a goroutine stack trace shows the contents of the call stack at that moment in time, so if asked to produce a stack trace by our support team, it’s important to perform the procedure while the problem is happening, so that any problematic functions will be present in the stack.

To get the stack dump written to a file, execute:

kubectl -n <kots-namespace> exec -it deployment/kotsadm curl http://localhost:3030/goroutines > goroutines.txt