合规国际互联网加速 OSASE为企业客户提供高速稳定SD-WAN国际加速解决方案。 广告
[TOC] ## 运行时 ### docker ```shell $ curl --unix-socket /var/run/docker.sock -X GET http://localhost/debug/pprof/profile > docker.profile $ curl --unix-socket /var/run/docker.sock -X GET http://localhost/debug/pprof/heap > docker.heap $ curl --unix-socket /var/run/docker.sock -X GET http://localhost/debug/pprof/goroutine > docker.goroutine ``` ### containerd >[info] 确认主机上 `/run/containerd/debug.sock` 是否有debug的socket文件。如没有的话,请将 [debug] 下的 address 参数配置成上面的文件。**重启containerd服务,重启containerd服务不会导致跑在pod里面的业务重启** ```shell $ grep -A1 "\[debug\]" /app/containerd/config/config.toml [debug] address = "/run/containerd/debug.sock" ctr pprof heap > containerd.heap ctr pprof profile > containerd.profile ctr pprof goroutines > containerd.goroutines ``` ## kube-apiserver ```shell kubectl proxy --address='0.0.0.0' --accept-hosts='^*$' curl -o kube-apiserver.heap http://localhost:8001/debug/pprof/heap curl -o kube-apiserver.profile http://localhost:8001/debug/pprof/profile curl -o kube-apiserver.goroutine http://localhost:8001/debug/pprof/goroutine ``` ## kube-controller-manager ```shell ``` ## kube-scheudler ```shell ``` ## kubelet ```shell kubectl proxy --address='0.0.0.0' --accept-hosts='^*$' curl http://192.168.32.127:8001/api/v1/nodes/[k8s节点名称]/proxy/debug/pprof/profile -o kubelet.heap curl http://192.168.32.127:8001/api/v1/nodes/[k8s节点名称]/proxy/debug/pprof/profile -o kubelet.profile curl http://192.168.32.127:8001/api/v1/nodes/[k8s节点名称]/proxy/debug/pprof/goroutine -o kubelet.goroutine ``` ## kube-proxy > 需要在配置文件(kubectl -n kube-system get cm kube-proxy)中将 `enableProfiling` 设置为 `true` 的值。 ```shell curl localhost:10249/debug/pprof/heap -o proxy.heap curl localhost:10249/debug/pprof/profile -o proxy.profile curl localhost:10249/debug/pprof/goroutine -o proxy.goroutine ```