Personal Collection of kubectl plugins
Find a file
2026-06-15 14:33:33 +02:00
kubectl-context feat: misc changes 2026-06-15 14:21:17 +02:00
kubectl-ctx [c] rename kubectl-cxt to kubectl-ctx 2025-04-16 10:02:11 +02:00
kubectl-insp Initial Commit 2024-11-11 12:59:55 +01:00
kubectl-inspect feat: misc changes 2026-06-15 14:21:17 +02:00
kubectl-namespace feat: misc changes 2026-06-15 14:21:17 +02:00
kubectl-ns Initial Commit 2024-11-11 12:59:55 +01:00
kubectl-show feat: misc changes 2026-06-15 14:21:17 +02:00
README.md docs: mention $PATH 2026-06-15 14:33:33 +02:00

personal kubectl plugin collection

This repo contains a personal collection of useful kubectl utilities I can't live without. Mainly:

  • kubectl context - switches kubectl context (shorthand: kubectl ctx)
  • kubectl namespace - switches kubectl namespace (shorthand: kubectl ns)
  • kubectl inspect - pipes kubectl get -o yaml output to bat for syntax highlighting (shorthand: kubectl insp)
  • kubectl show - shows truly all resources in the given namespace (unlike kubectl get all; accepts -A as well for monstrous outputs >:D)

Installation

You can simply clone this repository into ~/.kube/plugins and keep it up-to-date with git:

mkdir -p ~/.kube/plugins
git clone https://gitpot.org/sangelo/kubectl-plugins ~/.kube/plugins

Also make sure to add this directory to your $PATH so you can run the plugins from anywhere.

# in your .bashrc or .zshrc, or whatever shell you use
export PATH="$HOME/.kube/plugins:$PATH"

Usage

kubectl context

Lists all contexts or switches to the specified one.

Usage: kubectl context [CONTEXT_NAME]

  • If CONTEXT_NAME is provided, switch to that context
  • If no arguments are provided, list all available contexts

Examples

List contexts:

$ kubectl context
CURRENT   NAME      CLUSTER                AUTHINFO                NAMESPACE
*         prod      prod.example.com       admin                   default
          dev       dev.example.com        admin                   kube-system

Switch context:

$ kubectl context dev
Switched to context "dev".

kubectl namespace

Lists all namespaces or switches to the specified one.

Usage: kubectl ns [namespace]

  • Switch to the specified namespace or list available namespaces if no argument is provided.

Examples

List namespaces:

$ kubectl namespace
CURRENT  NAME
         default
*        kube-system
         example
...

Switch to a namespace:

$ kubectl namespace kube-system
Context "dev" modified.
Switched to namespace: kube-system

kubectl inspect

Inspects a Kubernetes resource and outputs it in the specified format using bat.

Usage: kubectl inspect [-o output_format] <kubectl_args>

  • -o output_format: Specify output format (e.g., json, yaml, wide, custom-columns, etc. - default: yaml)
  • kubectl_args: Arguments to pass to kubectl get command

Examples

# inspect a pod
kubectl inspect pod my-pod

# inspect a deployment and output to json
kubectl inspect -o json deployment my-deployment

kubectl show

Lists all resources in the specified namespace or the current namespace if no argument is provided.
Difference to kubectl get all: Truly lists all available resources, not just a few basic ones.

Usage: kubectl-show [flags]

  • Fetches truly ALL namespaced resources, passing standard kubectl get flags.

Examples

# show all resources in the current namespace
kubectl show

# show all resources in the "kube-system" namespace
kubectl show -n kube-system

# show all resources in ALL namespaces
kubectl show -A