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

FYI, this worked for me with kotsadm 1.87.0:

kubectl -n <kots-namespace> exec -it pod/kotsadm-0 curl http://localhost:3030/goroutines

There actually was no deployment.
But since kots is created as a statefulset, the pod name is predicable.

@tomk thanks for the update! you’re right, the Admin Console has a few modes now, so it won’t always be a Deployment