Debugging Go Services in Kubernetes with Skaffold and Telepresence

By Peter ONeill

Elevator Pitch

Unable to reproduce an issue locally and the production logs aren’t helping? Let me show you how to debug your local Go services as if they were in the production cluster with Telepresence, then iterate at speed with Skaffold creating your ultra-fast inner-dev-loop.

Description

In a perfect world, we have unit tests and fmt.Printf for every function we write. But in the real world, we have more code than we know what to do with, and then you wrap a container around all of your code making it even harder to debug. Being able to quickly go from fixing code to testing it in a cluster is essential for any Go developer using Kubernetes. And as the idea of the monolith application fades away so too should the idea of debugging services in isolation. We need tools that are designed to keep up with the complexities of microservice architecture.

Each development iteration on your Cloud Native application can be really slow. You have to compile your code as a container image, update deployments in Kubernetes, and wait for everything to catch up. Adding Skaffold to your development toolset is like picking up a speed power-up; as your write your code it’s packaged and deployed to your local cluster automatically.

Adding Telepresence to your development loop creates a feedback cycle that eliminates the guesswork around if your fix will work once it’s pushed to production. Projecting your local GO service into a remote cluster gives you real-time feedback on how it will perform with dependencies you can’t recreate on your local machine.

Writing Go Code for cloud native apps adds a lot of challenges. But building your inner-dev-loop with a cloud native first mindset is a surefire way to save time and speed up the debugging process.

Notes

This talk will focus on debugging a local Go service deployed to a local Kubernetes cluster running in a Docker. This local Go service will have dependencies from services running in a remote cluster hosted in GKE. This configuration for writing and debugging code has been particularly effective for me. For Go developers that may be adopting cloud native practices, this talk may be especially helpful. My personal journey; I graduated from a coding bootcamp about 2 years ago, last year I received 4 AWS certifications and then moved into the world of Kubernetes, and shortly after I earned my CKAD. Going through this journey myself I feel I would effective at connecting with other developers facing similar challenges.

I’ve also recently published an article about using these tools together: https://blog.getambassador.io/super-fast-inner-development-loops-for-kubernetes-with-skaffold-and-telepresence-1cd3e42ba665