kubectl-plugins

Plugins

Reference for each plugin, with flags and examples.

Kubernetes plugins

These use only your kubeconfig and the Kubernetes API. All of them accept the standard kubectl flags (--context, --kubeconfig, -n).

PluginUse it toExample
countCount any resource typekubectl count pods -A
cloneCopy a resource with the same valueskubectl clone deploy web web-copy
unhealthyFind pods that are broken, and whykubectl unhealthy -A
pendingExplain why pods are unschedulablekubectl pending -A
restartsRank pods by restarts and last termination reasonkubectl restarts -A --min 5
imagesList images in use and flag mutable tagskubectl images -A --latest
orphansFind unused ConfigMaps, Secrets, PVCs and Serviceskubectl orphans -A
whoamiShow who the API server thinks you arekubectl whoami
pingPing an address or DNS name from inside a podkubectl ping web-7d4b9 8.8.8.8

AKS plugins

These call Azure’s management API. Read AKS targeting first for the shared flags and authentication.

PluginUse it toExample
aksList, describe, upgrade, start and stop clusterskubectl aks describe
nodepool (np)Manage node poolskubectl np scale userpool --count 5
aks-versionsSee available Kubernetes versionskubectl aks-versions --patches
aks-maintenanceManage maintenance windowskubectl aks-maintenance list

Common workflows

Why is my deployment not running?

kubectl pending -l app=web      # stuck in the scheduler?
kubectl unhealthy -l app=web    # scheduled but crashing or not Ready?
kubectl restarts -l app=web     # how often, and why did it last die?

Can this pod reach the outside world?

kubectl ping web-7d4b9 8.8.8.8                       # raw egress
kubectl ping web-7d4b9 my-svc.my-ns.svc.cluster.local  # DNS and in-cluster routing

Wrong cluster, wrong user?

kubectl whoami --context prod   # confirm identity and groups before changing anything

Cleaning up a namespace

kubectl orphans -n staging      # unused ConfigMaps, Secrets, PVCs and dead Services
kubectl images -n staging --latest

Before an AKS upgrade

kubectl aks describe                 # current and available versions
kubectl aks-versions --patches       # upgrade paths in this region
kubectl unhealthy -A                 # fix existing problems first
kubectl aks upgrade --kubernetes-version 1.30.4