我想用perf/flame graph分析部署在k8s集群上的服务,但是无法安装在pod中。我的程序是用C++编写的,所以很遗憾无法用kubectl flame
插件分析。
root@mypod:/app# perf
WARNING: perf not found for kernel 5.4.0-1044
You may need to install the following packages for this specific kernel:
linux-tools-5.4.0-1044-gke
linux-cloud-tools-5.4.0-1044-gke
You may also want to install one of the following packages to keep up to date:
linux-tools-gke
linux-cloud-tools-gke
root@mypod:/app# apt-get install -y linux-tools-5.4.0-1044-gke
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package linux-tools-5.4.0-1044-gke
E: Couldn't find any package by glob 'linux-tools-5.4.0-1044-gke'
E: Couldn't find any package by regex 'linux-tools-5.4.0-1044-gke'
root@mypod:/app#
root@mypod:/app# apt-get install -y linux-cloud-tools-5.4.0-1044-gke
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package linux-cloud-tools-5.4.0-1044-gke
E: Couldn't find any package by glob 'linux-cloud-tools-5.4.0-1044-gke'
E: Couldn't find any package by regex 'linux-cloud-tools-5.4.0-1044-gke'
或者还有别的办法?
2条答案
按热度按时间4szc88ey1#
两个最常见的“无修改”跟踪工具是bpftrace和systemtap。虽然不知道其中一个是否能在GKE的COS上工作,但你肯定需要在工具沙箱中的实际VM上工作,而不是在pod中。或者可以使用gprof,但这需要在配置文件支持激活的情况下编译可执行文件。
kgsdhlau2#
如果您的k8s cgroupfs驱动程序不是systemd,您可以使用perf和选项'-G'以及容器名称。您可以尝试通过perf doc获取信息。