4

Rancher 给 kube-apiserver 开启 pprof - 颇忒脱的技术博客

 1 year ago
source link: https://chanjarster.github.io/post/rancher/kube-apiserver-profiling/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Rancher 给 Kube-Apiserver 开启 Pprof

注意:本文档没有亲自试验过,仅供参考。

先看 kuber-apiserver 的启动参数:

docker inspect kube-apiserver
...
"Args": [
    ...
    "--profiling=false",
    ...
]

可以看到 profiling 没有开,因此 /debug/pprof 接口是没有办法调用的。

编辑 RKE cluster.yaml,把 profiling 打开:

services:
  kube-api:
    ...
    extra_args:
      profiling: "true"

然后使用 RKE 升级集群:

rke up --config ./rancher-cluster.yml

然后启动(注意 kube_config_cluster.yml 是 RKE 安装 K8S 之后生成的):

kubectl --kubeconfig kube_config_cluster.yml proxy
Starting to serve on 127.0.0.1:8001

访问浏览器 http://localhost:8001/debug/pprof


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK