pulumi / kubespy

Tools for observing Kubernetes resources in real time, powered by Pulumi.
https://pulumi.com/
Apache License 2.0
2.89k stars 92 forks source link

kubespy: tools for observing Kubernetes resources in real time

What happens when you boot up a Pod? What happens to a Service before it is allocated a public IP address? How often is a Deployment's status changing?

kubespy is a small tool that makes it easy to observe how Kubernetes resources change in real time, derived from the work we did to make Kubernetes deployments predictable in Pulumi's CLI. Run kubespy at any point in time, and it will watch and report information about a Kubernetes resource continuously until you kill it.

Examples

kubespy trace deployment nginx will "trace" the complex changes a complex Kubernetes resource makes in the cluster (in this case, a Deployment called nginx), and aggregate them into a high-level summary, which is updated in real time.

Changes

kubespy status v1 Pod nginx will wait for a Pod called nginx to be created, and then continuously emit changes made to its .status field, as syntax-highlighted JSON diffs:

Changes

Installation

You can install kubespy in the following ways:

Homebrew (Mac)

Prerequisite: homebrew

brew install kubespy

Binary

Get the latest release, rename it to kubespy, run chmod +x kubespy to make it executable and move it in your path (can be /usr/local/bin).

Kubectl Plugin

Prerequisite: kubectl v1.12.0 or later

With kubectl v1.12.0 introducing easy pluggability of external functions, kubespy can be invoked as kubectl spy just by renaming it to kubectl-spy and having it available in your path.

via Golang

Prerequisite: Go version 1.19 or later

go install github.com/pulumi/kubespy@latest

Usage

kubespy has four commands:

Several more commands are planned as well.

Examples

For a concrete example you can run using either Pulumi CLI or kubectl, check out examples/trivial-pulumi-example.

Features