Linkerd 2.10(Step by Step)—控制平面调试端点

简介: Linkerd 2.10(Step by Step)—控制平面调试端点

所有控制平面组件(Grafana 除外) 都使用 Go 的 pprof 包 通过路径 /debug/pprof 暴露运行时分析信息。


您可以使用 go tool pprof 使用提供的数据以生成多种格式(PDF、DOT、PNG 等)的输出。


提供了以下诊断(/debug/pprof 提供了带链接的摘要):


  • allocs: 过去所有内存分配的样本
  • block: 导致同步原语阻塞的堆栈跟踪
  • cmdline: 当前程序的命令行调用
  • goroutine: 所有当前 goroutine 的堆栈跟踪
  • heap: 活动对象的内存分配示例。您可以指定 gc GET 参数以在获取堆样本之前运行 GC
  • mutex: 竞争互斥锁持有者的堆栈跟踪
  • profile: CPU 配置文件。您可以在 seconds GET 参数中指定持续时间。获取配置文件后,使用 go tool pprof 命令调查配置文件。
  • threadcreate: 导致创建新 OS 线程的堆栈跟踪
  • trace: 当前程序的执行轨迹。您可以在 seconds GET 参数中指定持续时间。获取跟踪文件后,使用 go tool trace 命令调查跟踪。


示例用法



此数据通过 admin-http 端口提供。要找到此端口, 您可以检查 pod 的 yaml,或者对 identity pod,发出如下命令:


kubectl -n linkerd get po \
    $(kubectl -n linkerd get pod -l linkerd.io/control-plane-component=identity \
        -o jsonpath='{.items[0].metadata.name}') \
    -o=jsonpath='{.spec.containers[*].ports[?(@.name=="admin-http")].containerPort}'


然后使用 kubectl port-forward 命令从集群外部访问该端口(在本例中,端口为 9990):


kubectl -n linkerd port-forward \
    $(kubectl -n linkerd get pod -l linkerd.io/control-plane-component=identity \
        -o jsonpath='{.items[0].metadata.name}') \
    9990


现在可以使用 go tool 来检查这些数据。例如,在 PDF 文件中生成描述内存分配的图表:


go tool pprof -seconds 5 -pdf http://localhost:9990/debug/pprof/allocs
相关文章
|
5月前
|
JavaScript
龙骨mesh渲染异常,最终发下是mesh设置的问题
龙骨mesh渲染异常,最终发下是mesh设置的问题
44 0
|
Prometheus Cloud Native 数据可视化
Linkerd 2.10(Step by Step)—4. 如何配置外部 Prometheus 实例
Linkerd 2.10(Step by Step)—4. 如何配置外部 Prometheus 实例
138 0
|
Kubernetes API 容器
Linkerd 2.10(Step by Step)—使用请求跟踪调试 gRPC 应用程序
Linkerd 2.10(Step by Step)—使用请求跟踪调试 gRPC 应用程序
140 0
Linkerd 2.10(Step by Step)—使用请求跟踪调试 gRPC 应用程序
|
JSON Prometheus Kubernetes
Linkerd 2.10(Step by Step)—使用每个路由指标调试 HTTP 应用程序
Linkerd 2.10(Step by Step)—使用每个路由指标调试 HTTP 应用程序
134 0
Linkerd 2.10(Step by Step)—使用每个路由指标调试 HTTP 应用程序
|
存储 数据可视化 应用服务中间件
Linkerd 2.10(Step by Step)—使用 Linkerd 进行分布式跟踪
Linkerd 2.10(Step by Step)—使用 Linkerd 进行分布式跟踪
222 0
Linkerd 2.10(Step by Step)—使用 Linkerd 进行分布式跟踪
|
JSON Kubernetes 安全
Linkerd 2.10(Step by Step)—多集群通信
Linkerd 2.10(Step by Step)—多集群通信
273 0
Linkerd 2.10(Step by Step)—多集群通信
|
应用服务中间件 测试技术 API
Linkerd 2.10(Step by Step)—混沌工程之注入故障
Linkerd 2.10(Step by Step)—混沌工程之注入故障
282 0
Linkerd 2.10(Step by Step)—混沌工程之注入故障
|
存储 Kubernetes 安全
Linkerd 2.10(Step by Step)—手动轮换控制平面 TLS 凭证
Linkerd 2.10(Step by Step)—手动轮换控制平面 TLS 凭证
126 0
|
Kubernetes 网络协议 Go
Linkerd 2.10(Step by Step)—调试 502s
Linkerd 2.10(Step by Step)—调试 502s
|
Prometheus Cloud Native Go
Linkerd 2.10(Step by Step)—获取每条路由指标
Linkerd 2.10(Step by Step)—获取每条路由指标
108 0