Debugging Go Microservices in Kubernetes With VScode

Many organizations adopt cloud native development practices with the dream of shipping features faster. Although the technologies and architectures may change when moving to the cloud, the fact that we all still add the occasional bug to our code remains constant. The snag is that many of your existing local debugging tools and practices can’t be used when everything is running in a container or on the cloud.

Easy and efficient debugging is essential to being a productive engineer, but when you have a large number of microservices running in Kubernetes the approach you take to debugging has to change. For one, you typically can’t run all of your dependent services on your local machine. This then opens up the challenges of remote debugging (and the associated fiddling with debug modes and exposing ports correctly). However, there is another way. And the CNCF Telepresence tool enables this path.

Cloud Development Environments: Using Skaffold and Telepresence on Kubernetes

Skaffold is an open-source project created by Google. It provides a development framework for Kubernetes-based applications. This framework creates a fast, repeatable, and simple local Kubernetes workflow. Put simply, this means that it handles all the hard bits of managing a cloud-native local development environment, such as building images and deploying to Kubernetes. With Skaffold handling the hard bits, you save time with every iteration you make in development.

Telepresence is an open-source tool created by Ambassador Labs. Telepresence makes Kubernetes developers super productive by letting them code as if their laptop is in their Kubernetes cluster. This way you can query cluster resources and experiment rapidly with other services in real-time.

Eliminating Local Resource Constraints for Building Cloud-Native Applications

Is Minikube melting your laptop? Are your local integration tests suffering because you can’t run dependencies on your development machine?

As organizations adopt Kubernetes and cloud-native architectures, development teams will often run into resource constraints as their architectures get more complex. Additionally, Kubernetes presents new challenges for configuring local development environments in comparison with legacy monolithic applications.

Debugging Microservices Running on Kubernetes

In order to learn more about microservices, container orchestration, and service meshes, I’ve set up a local development environment with Minikube, Istio, and tools like Kiali and created a sample application. In this article, I describe how to debug these services locally.

Microservices can be developed in various languages and with multiple frameworks. For the different implementation types, there are specialized and established IDEs (integrated development environments) and tools to debug the single services.