A kubectl plugin that enables low-overhead profiling of Kubernetes pods by generating flame graphs without modifying existing pods.
Kubectl plugin for effortless profiling on kubernetes
kubectl-flame is used by developers and DevOps engineers to profile production applications running in Kubernetes clusters, helping them identify performance bottlenecks through flame graphs. It supports multiple languages and container runtimes, making it ideal for performance analysis in containerized environments without requiring pod modifications.
Profiling Java applications in Alpine-based containers requires the --alpine flag. For NodeJS profiling, the node process must be started with the --perf-basic-prof flag to resolve JavaScript symbols. The tool launches a Kubernetes Job on the same node as the target pod and uses language-specific profilers under the hood. It supports clusters using Docker and containerd runtimes, but containerd requires specifying the runtime path.
Install Krew package manager for kubectl plugins if not already installed
Run `kubectl krew install flame` to install kubectl-flame plugin
Alternatively, download pre-built binaries from the release page
kubectl flame mypod -t 1m --lang java -f /tmp/flamegraph.svg
Profile a Java application in pod 'mypod' for 1 minute and save the flame graph to /tmp/flamegraph.svg
kubectl flame mypod -t 1m -f /tmp/flamegraph.svg --lang java --alpine
Profile a Java application in an Alpine-based container with the --alpine flag
kubectl flame mypod -t 1m --lang go -f /tmp/flamegraph.svg mycontainer
Profile a Go application in a specific container 'mycontainer' within a multi-container pod
kubectl flame mypod -t 1m --lang go -f /tmp/flamegraph.svg --pgrep go-app
Profile a Go application in a multi-process container by specifying the target process name
kubectl flame mypod -t 1m --docker-path /run/containerd
Run profiling on Kubernetes clusters using containerd runtime by specifying the containerd runtime path