1. 程式人生 > >debugging kubernetes (Delve and Goland)

debugging kubernetes (Delve and Goland)

all example park mman creat The location amp png

1. Build from source

cd GOPATH

mkdir k8s.io

cd k8s.io

git clone https://github.com/kubernetes/kubernetes.git

Note : make the location of sure source code at $GOPATH/k8s.io/kubernetes

example :

GOPATH/src/github.com/xuchencn/xxxx

GOPATH/src/k8s.io/kubernetes

cd $GOPATH/k8s.io/kubernetes

make

After make find cmds on "_output/bin/"

2.Install delve

Follow the delve‘s toturial to install delve

After install you can debugging use delve or use Goland

3.Debugging by Goland

Example by apiserver

cd $GOPATH/src/k8s.io/kubernetes/cmd/kube-apiserver/

$GOPATH/bin/dlv debug --headless --listen=:2345 --api-version=2 -- k8s.io/kubernetes/cmd/kube-apiserver/apiserver.go --etcd-servers http://localhost:2379

After the command delve will output a "debug" file in current directory and listen on 2345 port

Open Goland create new remote debug

技術分享圖片

Don‘t forget create breakingpoints before debugging

技術分享圖片

debugging kubernetes (Delve and Goland)