What is the best way to debug an app deployed to Kubernetes locally using Docker Desktop?

Viewed 700

I have experience using Docker to develop a relatively complex application. It is very easy to debug an app using Visual Studio (2019). I just set docker-compose.yaml as the startup app and start debugging.

Is it possible to debug an application that is published to Kubernetes locally using Docker Desktop? By debug I mean set breakpoints etc? I have spent a few hours Googling this and I have got nowhere and hence the reason for the question.

Please note that I am not asking how to debug an app that is published to Kubernetes in the Cloud e.g. Azure - there are plenty of webpages that explain how to do that.

3 Answers

Telepresence may be a very good fit for you.

Using telepresence you can debug your Kubernetes service locally, using your favorite debugging tool. So it doesn't matter where your K8S cluster is.

Take a look on this tutorial to check how it works.

HOW IT WORKS:

Telepresence substitutes a two-way network proxy for your normal pod running in the Kubernetes cluster. This pod proxies data from your Kubernetes environment (e.g., TCP connections, environment variables, volumes) to the local process. The local process has its networking transparently overridden so that DNS calls and TCP connections are routed through the proxy to the remote Kubernetes cluster.

you can stdout docker logs , use kubectl logs pod_name -n namespace_name

Related