DEV Community

SteveSims2
SteveSims2

Posted on

Step through debugging of code running in Kubernetes using VS2019 SSH attach (Part 2)

Get your desktop ready for debugging

Ok now, open Visual Studio 2019, and get the sources that match the code running on your pod. Compile them. Set the project for your app as the Startup Project. Choose Debug -> Attach to Process.
Alt Text
Choose SSH
Click the Refresh Button
Alt Text
Fill out the fields in the dialog with the master node name, the port of the SSH service, the root account and the password that you assigned to the root account. Press Connect
Alt Text
Choose the dotnet process and click Attach
Alt Text
Check Managed (.Net Core for Unix) and press OK.

Set a breakpoint in the run loop of the code, and wait. When that line executes the code will break:
Alt Text
From this point you can step, hover over variables, or anything you might do when debugging locally.

Top comments (0)