Coder Social home page Coder Social logo

kubectl-flame's Introduction

kubectl flame ๐Ÿ”ฅ

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

Running kubectlf-flame does not 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 pod mypod 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 is java. Use --pgrep flag if your process name is different.

Installing

Krew

You can install kubectl flame using the Krew, the package manager for kubectl plugins.

Once you have Krew 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 hood kubectl-flame use async-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 on ebpf profiling. Python support is based on py-spy. Ruby support is based on rbspy. NodeJS support is based on perf. In order for Javascript Symbols to be resolved, node process needs to be run with --perf-basic-prof flag.

Contribute

Please refer to the 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 the Apache 2.0 open source license. Please refer to LICENSE for the full terms.

kubectl-flame's People

Contributors

adriananeci avatar alowde avatar dontmint avatar edenfed avatar enc avatar italux avatar kujon avatar loicmathieu avatar mehrdadrad avatar michaelgugino avatar obitech avatar u6f6o avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.