Skip to content
A kubectl plugin to use pyflame to debug python pods in k8s
Shell Dockerfile
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
pics
Dockerfile
LICENSE
README.md
kubectl-pyflame

README.md

kubectl-pyflame

Use pyflame to snapshot flame graph on running python pod in k8s cluster.

demo

example svg file:

flame

Install

wget https://raw.githubusercontent.com/monsterxx03/kube-pyflame/master/kubectl-pyflame

chmod +x kubectl-pyflame

mv kubectl-pyflame /usr/local/bin/

kubectl pyflame -h

Usage

kubctl pyflame -n <namespace> -p <pod_name> -m <python process match> -r <inspect rate> -s <inspect seconds>

svg file will be donwloaded to current dir.

Internal

Steps:

  • find running node for target pod
  • launch a pod with pyflame image on target node (to inspect process in another namespace, container is privileged, pod is set hostPID: true)
  • list target process match -m option
  • enter target pid
  • pyflame do snapshot and output svg file
  • download svg file to local
  • delete debug pod
You can’t perform that action at this time.