You know how ksniff allows to remote
tcpdump a pod? Well this project attaches a debugger for Operators using dlv
.
This is purely an adaptation of the ksniff source code.
make build install
Attach to pid #1 on the konnectivity-agent-p9ppv
pod in the kube-system
namespace and redirect the remote debugger port on your local machine
(2345/TCP by default):
kubectl dmm -n kube-system konnectivity-agent-p9ppv
Trying to Ctrl+C to shut it all off will only stop the port-forward. If you want to also kill the remote debugger:
oc dmm -n kube-system konnectivity-agent-p9ppv --force-kill
- Finds your pod
- Uploads
dlv
(https://github.com/go-delve/delve, a go debugger) onto the pod (in /tmp/dlv by default). Have your pick of upload methods:direct
is equivalent tokubectl cp
and only works if the pod hastar
.stager
creates a stager pod, copies the debugger to it, then usescurl
from the pod to debug to retrieve the debugger.
- Attaches the debugger for a pid on your pod and listens for debug commands on a port (2345/tcp by default)
- Locally spawns a port-forward (kubectl port-forward) to expose the remote debugger port onto your local machine