DebugHero vs. other tools
Many tools help you debug services in Kubernetes. They solve different problems. This page compares them, so that you can select the correct tool for each task.
DebugHero does one thing: it attaches Delve to a Go process that already runs in a pod, and it connects your IDE to it. Use it when you must see the state of the real process at the moment of the problem.
Summary
| Tool | What you debug | Change to the workload | IDE breakpoints |
|---|---|---|---|
| DebugHero | The running Go process in the pod | Adds an ephemeral container | Yes, set up for you |
kubectl debug | The running pod, or a copy | Adds an ephemeral container, or creates a copy | Manual setup |
| Delve in the image | The process, started under Delve | New image and deployment | Manual setup |
| mirrord | A process on your machine, with the cluster context | Starts an agent in the cluster | Yes, local debugger |
| Signadot | A sandbox version of your service | Creates sandbox workloads | Through a local or sandbox workload |
| cdebug, kpexec | The container, with a shell and tools | Starts a debug container | No |
kubectl debug
kubectl debug is part of kubectl. It can add an ephemeral container to a pod, the same as DebugHero. With --profile=general, the container gets the SYS_PTRACE capability.
After that, you must do the other steps yourself: use an image that contains Delve, find the PID, start dlv attach with the correct flags, forward the port, and configure the IDE and the source path mapping. DebugHero does these steps for you, and it keeps the status of each session.
Use kubectl debug when you need a shell or network tools in the pod, or when you cannot install DebugHero.
Delve in the image
You can build an image that starts your service under Delve, for example dlv exec --headless. This works on every cluster, with no ephemeral containers and no extra capabilities at runtime.
But you must build and deploy a special image, and the pod restarts. A problem that depends on state or timing can be gone after the restart. The debug image must not stay in production.
Use this method for a development environment where you deploy debug builds all the time.
mirrord
mirrord runs your service on your machine and connects it to the cluster. It mirrors or steals the traffic of a remote pod, and it gives your local process the environment variables, files, and network of that pod. It starts an agent in the cluster to do this. You debug the local process with your usual debugger.
mirrord does not debug the process in the pod. Use mirrord to run new code against real traffic and real dependencies before you deploy it. Use DebugHero to examine the process that already runs, with its current memory and state.
Signadot
Signadot creates sandboxes: versions of one or more services that receive only the requests that are routed to them. A developer can test a change in a shared cluster without a full copy of the environment.
Signadot is for testing changes. It does not attach a debugger to a running process.
cdebug and kpexec
cdebug and kpexec start a debug container next to the target container, or on the same node. The container gives you a shell and tools in the namespaces of the target, also for distroless images.
They help you examine files, processes, and the network of a container. They do not set up a source-level debugger or an IDE connection.
When to use DebugHero
- A Go service shows a problem in the cluster that you cannot reproduce on your machine.
- You must see variables, goroutines, and the call stack of the real process.
- You cannot rebuild or restart the service to investigate.
When a breakpoint stops the process, the process does not answer requests. On a production service, use conditional breakpoints or logpoints, and select a pod that does not receive critical traffic. See Limitations.