kubectl-shovel

module
v0.6.0-beta.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 21, 2022 License: Apache-2.0

README

kubectl shovel

Testing and publishing Go Report Card FOSSA Status GitHub Release

Plugin for kubectl that will help you to gather diagnostic info from running in Kubernetes dotnet applications. It can work with .NET Core 3.0+ applications and Kubernetes clusters with docker or containerd runtime.

At the moment the following diagnostic tools are supported:

  • dotnet-gcdump
  • dotnet-trace
  • dotnet-dump

Inspired by kubectl-flame.

Installation

Krew

You can install kubectl shovel via krew. At first install krew if you don't have it yet following the guide - Installing. Then you will be able to install shovel plugin:

kubectl krew install shovel
Precompiled binaries

You can find latest release on repository release page. Once you download compatible with your OS binary, move it to any directory specified in your $PATH.

Usage

Feel free to use it as a kubectl plugin or standalone executable (kubectl shovel/kubectl-shovel)

Get gcdump:

kubectl shovel gcdump --pod-name pod-name-74df554df7-qldq7 -o ./dump.gcdump

Or trace:

kubectl shovel trace --pod-name pod-name-74df554df7-qldq7 -o ./trace.nettrace

Or get full memory dump:

kubectl shovel dump --pod-name pod-name-74df554df7-qldq7 -o ./memory.dump --type full

Most of dotnet tools flags supported as well to use, e.g --duration and --format for trace. You can find more info and examples in cli documentation or by using -h/--help flag.

How it works

It runs the job with specified tool on the specified pod's node and mount its /tmp folder with dotnet-diagnostic socket. So it requires permissions to get pods and create jobs and allowance to mount /var/lib/docker path for docker runtime and /run/containerd for containerd from a host in read-only mode.

Development

To run all kinds of checks and generators please use:

make prepare
Prerequisites
  • golang
  • docker
  • kind
Testing
Unit tests:
make test-unit
Integration tests

kind-clusters use containerd as container runtime, so functionality with docker-runtime won't be covered.

  • Integration tests require running kind-cluster. You can create it with kind create cluster. Also you can specify some version for cluster: kind create cluster --image=kindest/node:<version>, e.g v1.19.1 version.
  • Then run integration tests with make test-integration. It will:
    • Build docker image for dumper
    • Upload it to kind-cluster
    • Build CLI
    • Run tests using these artifacts
All in one
make test

Directories

Path Synopsis
cli
cmd
cmd
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL