How to run procdump within a Kubernetes Pod

Applies on Windows Node pools

TL;DR

First get a shell within the pod:

kubectl exec --stdin --tty <Pod Name> -n <Pod Namespace> -- cmd

then install procdump using choco:

C:\> choco install procdump

find the running processes:

C:\> powershell
PS C:\> Get-Process
PS C:\> exit

then run procdump:

C:\> procdump -e 1 -f "" <process id>

Use Case

So, I needed to find a way to debug an application (.NET) running on a Windows Pod. The app was running, but not working as expected, it was crashing before even App Insights was loaded - so I was pretty much blind on what was going on. On the good old days I would use procdump to log exceptions on my console (procdump -e 1 -f "" w3wp.exe) , but how to do such a thing when the app runs on Kubernetes? Well, first I needed to get a shell within the pod / container (?), then install procdump (?), then get my process id (?), and finally running the procdump with the proper switches. As it ends up, all of the above are just 4 commands away...