Giter Site home page Giter Site logo

kstrace's Introduction

kstrace

This tool is a kubectl plugin that is used to collect strace data from Pods running with your Kubernetes cluster.

Description

This tool is a kubectl plugin used for watching and reviewing system-calls from processes running inside Pods in a Kubernetes cluster.

The tool creates a privileged Pod in the cluster which will 'attach' to the running target Pod and will stream the strace data back to the end user.

This application also allows for strace monitoring of multiple Pods (DaemonSets, Deployments, Services) at the same time by streaming the results back into a designated folder.

Installation

Install using Krew:

kubectl krew install strace

Build from source:

# Build for the current OS
make build && cd bin/

# Cross-compile for all supported OSes
make all && cd bin/

Getting Started

To start watching a Pods strace calls on the command-line:

kubectl strace -o - <pod>

Multiple Pods or containers can be traced at the same time and collected into folders.

kubectl strace --trace-timeout=30s deployment/<deployment>

The kstrace application can trace the following Kubernetes resources identified by either their long name or short name: Deployment, DaemonSet, Service, Pod

The command flags for kstrace are listed below:

      --image string             The trace image for use when performing the strace. (default "quay.io/mwasher/crictl:0.0.2")
      --log-level string         The verbosity level of the output from the command. Available options are [panic, fatal, error, warning, info, debug, trace]. (default "info")
  -n, --namespace string         If present, the namespace scope for this CLI request
  -o, --output string            The directory to store the strace data. (default "strace-collection")
      --socket-path string       The location of the CRI socket on the host machine. (default "/run/crio/crio.sock")
      --trace-timeout string     The length of time to capture the strace output for. (default "0")

Limitations

Auto-completion of Kubectl plugins is currently not possible but is an active development. Kubernetes Issue 74178

When this functionality is merged into the Kubectl tool, this tool will be updated to be compliant with the Kubectl completion mechanisms.

Credits

This tool was inspired heavily by Ksniff. The ksniff tool provides a similar functionality for collecting network packet captures (PCAP) and was created by Eldad Rudich and maintained by Robert Bost. Although this tool was written independently to the KSniff tool, the developer for this tool has also worked on the Ksniff tool and portions may resemble the design of KSniff.

kstrace's People

Contributors

joachimsalim avatar konmoron avatar michaelwasher avatar timdawson264 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

kstrace's Issues

Close Gracefully

Capture Signals and close gracefully by removing all of the created resources

Limit Tracing to one tracePod per node

Currently if there are multiple target pods on the same node, each target Pod will have a tracePod created. The same could be achieved with a single tracePod created and running multiple exec commands (SDPY connections) to trace multiple PIDs.

This should not change the functionality but will just be an increase in performance.

Infer container runtime socket

Infer the container runtime socket location from the containerID of the target Pod and the defaults for each runtime. Currently just allows for overwrite

Automate version releases and update code tagging on release

There are a number of places within the code that reference the release version. This needs to be replaced with a value that is hard-coded at build-time and is associated with the Github Tag on the workflow.

This needs to be set in at least the Krew version and the kubectl strace version command. This should also push up a docker-image with the matching version of crictl on Quay and update the default --image value.

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.