Skip to content
Tools for observing Kubernetes resources in real time, powered by Pulumi.
Branch: master
Clone or download
muffl0n and lblackstone Add "Deployment" to supported types (#51)
"Deployment" is supported since a0d2c21
Latest commit f22323a Mar 19, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
cmd Restrict replicaSet watch by namespace Oct 19, 2018
examples Add kubespy trace example Sep 25, 2018
images Implement `kubespy trace deploy` Oct 3, 2018
k8sobject Implement `kubespy trace deploy` Oct 3, 2018
pods Refactor into separate commands (#20) Sep 29, 2018
print Use forked uilive to fix #38 Oct 9, 2018
scripts Add Makefile, various build utilities Oct 1, 2018
version Add Makefile, various build utilities Oct 1, 2018
watch Restrict replicaSet watch by namespace Oct 19, 2018
.gitignore Add Makefile, various build utilities Oct 1, 2018
.travis.yml Adds .travis.yml (#28) Oct 1, 2018
CODE_OF_CONDUCT.md Create CODE_OF_CONDUCT.md Sep 29, 2018
CONTRIBUTING.md Add CONTRIBUTING.md Sep 29, 2018
LICENSE Adopt Apache v2 license Sep 27, 2018
Makefile Implement `kubespy version` Oct 3, 2018
README.md Add homebrew install option to README (#48) Nov 26, 2018
ROADMAP.md Add "Deployment" to supported types (#51) Mar 18, 2019
go.mod Use forked uilive to fix #38 Oct 9, 2018
gometalinter.json Add Makefile, various build utilities Oct 1, 2018
kubespy.go

README.md

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.11 or later

kubespy can be installed via golang by running the following:

git clone git@github.com:pulumi/kubespy.git
cd kubespy
# If $GOPATH is not set, you can run `go build` instead, and then put in a
# binary directory on your path
GO111MODULE=on go install

Usage

kubespy has three commands:

  • status <apiVersion> <kind> [<namespace>/]<name>, which in real time emits all changes made to the .status field of an arbitrary Kubernetes resource, as a JSON diff.
  • changes <apiVersion> <kind> [<namespace>/]<name>, which in real time emits all changes to any field in a Kubernetes resource, as a JSON diff.
  • trace <kind> [<namespace>/]<name>, which "traces" the changes a complex Kubernetes resource makes throughout a cluster, and aggregates them into a high-level summary, which is updated in real time.

Several more commands are planned as well.

Examples

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

Features

  • Supports any resources the API server knows about, including CRDs (i.e., uses the discovery client to discover the available API resources, and allows users to query any of them).
  • Displays changes to API objects in real time.
  • Supports case-insensitive aliases (e.g. kubespy status v1 pod <name> instead of kubespy status v1 Pod <name>).
  • Supports status updates from regex and/or fuzzy matching (i.e., make it easy to watch the status of Pods generated by Deployments and ReplicaSets).
You can’t perform that action at this time.