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 the 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 would 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)