Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Kubectl plugin for effortless profiling on kubernetes

License

NotificationsYou must be signed in to change notification settings

yahoo/kubectl-flame

Repository files navigation

A kubectl plugin that allows you to profile production applications with low-overhead by generatingFlameGraphs

Runningkubectlf-flame doesnot require any modification to existing pods.

Table of Contents

Requirements

  • Supported languages: Go, Java (any JVM based language), Python, Ruby, and NodeJS
  • Kubernetes cluster that use Docker as the container runtime (tested on GKE, EKS and AKS)

Usage

Profiling Kubernetes Pod

In order to profile a Java application in podmypod for 1 minute and save the flamegraph as/tmp/flamegraph.svg run:

kubectl flame mypod -t 1m --lang java -f /tmp/flamegraph.svg

Profiling Alpine based container

Profiling Java application in alpine based containers require using--alpine flag:

kubectl flame mypod -t 1m -f /tmp/flamegraph.svg --lang java --alpine

NOTICE: this is only required for Java apps, the--alpine flag is unnecessary for Go profiling.

Profiling sidecar container

Pods that contains more than one container require specifying the target container as an argument:

kubectl flame mypod -t 1m --lang go -f /tmp/flamegraph.svg mycontainer

Profiling Golang multi-process container

Profiling Go application in pods that contains more than one process require specifying the target process name via--pgrep flag:

kubectl flame mypod -t 1m --lang go -f /tmp/flamegraph.svg --pgrep go-app

Java profiling assumes that the process name isjava. Use--pgrep flag if your process name is different.

Profiling on clusters running containerd

To run this tool on Kubernetes clusters that use containerd as the runtime engine, you must specify the path to the containerd runtime files:

kubectl flame mypod -t 1m --docker-path /run/containerd

Installing

Krew

You can installkubectl flame using theKrew, the package manager for kubectl plugins.

Once you haveKrew installed just run:

kubectl krew install flame

Pre-built binaries

See the release page for the full list of pre-built assets.

How it works

kubectl-flame launch a Kubernetes Job on the same node as the target pod.Under the hoodkubectl-flame useasync-profiler in order to generate flame graphs for Java applications.Interaction with the target JVM is done via a shared/tmp folder.Golang support is based onebpf profiling.Python support is based onpy-spy.Ruby support is based onrbspy.NodeJS support is based onperf. In order for Javascript Symbols to be resolved, node process needs to be run with--perf-basic-prof flag.

Contribute

Please refer tothe contributing.md file for information about how to get involved. We welcome issues, questions, and pull requests.

Maintainers

License

This project is licensed under the terms of theApache 2.0 open source license. Please refer toLICENSE for the full terms.


[8]ページ先頭

©2009-2025 Movatter.jp