Debugging .NET 6 Kubernetes containers

1/17/2022

Has someone experience in debugging .NET 6 F# code running in a service-less deployment/pod inside a kubernetes cluster in AKS with Visual Studio (ideally 2022)?

Bridge to Kubernetes is not available for VS 2022, and the VS2019 (and VS code) seems to require a service and an http access. In my case, I have microservices that only use the internal cluster networking between them with a messaging engine, without associated services.

Logs are helpful, but being able to debug would be great.

Ideas?

P.S.

This is a way, but it looks way too invasive

-- Franco Tiveron
.net-6.0
debugging
f#
kubernetes
visual-studio

1 Answer

1/18/2022

My experience with this sort of thing is with Java applications, but I assume it would be similar for this platform. This would typically be done with a "port-forward", described on this page: https://kubernetes.io/docs/tasks/access-application-cluster/port-forward-access-application-cluster/ .

Basically, this will provision a local port on your desktop, such that if you connect to that port on your desktop, it will actually be connecting to a mapped port on the pod in the cluster.

Once the port-forward is working, you can connect to that port from vscode.

In Java, this port would be the "debugger port", sometimes referred to as the JPDA port.

-- David M. Karr
Source: StackOverflow