MCPcopy Index your code
hub / github.com/dodopizza/kubectl-shovel

github.com/dodopizza/kubectl-shovel @v0.9.2

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.9.2 ↗ · + Follow
267 symbols 826 edges 63 files 79 documented · 30% updated 10mo agov0.9.3-beta.0 · 2025-08-13★ 521 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
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
  • createdump

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 managed memory dump:

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

Or get full (managed and unmanaged) memory dump with createdump utility:

kubectl shovel coredump --pod-name pod-name-74df554df7-qldq7 -o ./coredump.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

  • For dotnet-trace, dotnet-gcdump, dotnet-dump commands it runs job on pod's node and mounts
  • /tmp folder with dotnet-diagnostic socket
  • docker or containerd runtime folders (/var/lib/docker or /run/containerd)
  • For coredump command it runs privileged job (with SYS_PTRACE capability) on pod's node and mounts
  • /tmp folder with dotnet-diagnostic socket
  • docker or containerd runtime folders (/var/lib/docker or /run/containerd)
  • /proc folder mounted from host to find host process id for container

Development

To run all kinds of checks and generators please use:

make prepare

Prerequisites

  • golang
  • docker
  • kind
  • dotnet sdk

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 make test-integration-setup. 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

Extension points exported contracts — how you extend this code

DotnetTool (Interface)
(no doc) [1 implementers]
internal/flags/dotnet_tool_interface.go
DotnetToolFlagsFormatter (Interface)
(no doc) [1 implementers]
internal/flags/dotnet_tool_interface.go
DotnetToolFactory (FuncType)
(no doc)
internal/flags/dotnet_tool_interface.go

Core symbols most depended-on inside this repo

Run
called by 28
internal/watchdog/operator.go
FormatArgs
called by 18
internal/flags/dotnet_tool_interface.go
Append
called by 16
internal/flags/args.go
Type
called by 16
internal/flags/types/format.go
GetFlags
called by 15
internal/flags/dotnet_tool_interface.go
Get
called by 13
internal/flags/args.go
NewArgs
called by 11
internal/flags/args.go
Description
called by 9
internal/flags/types/format.go

Shape

Method 138
Function 88
Struct 23
TypeAlias 11
Class 4
Interface 2
FuncType 1

Languages

Go96%
C#4%

Modules by API surface

internal/kubernetes/jobs.go18 symbols
test/integration/helpers_test.go17 symbols
internal/flags/dotnet_tool_interface.go12 symbols
internal/kubernetes/containers.go10 symbols
internal/kubernetes/pods.go9 symbols
internal/flags/core_dump.go8 symbols
internal/flags/dotnet_trace.go7 symbols
internal/flags/dotnet_tool_resolver.go7 symbols
internal/flags/dotnet_tool.go7 symbols
internal/flags/dotnet_gcdump.go7 symbols
internal/flags/dotnet_dump.go7 symbols
internal/flags/args.go7 symbols

For agents

$ claude mcp add kubectl-shovel \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page