Before using inspector
you need to have kubectl binary installed and configured (config file ${HOME}/.kube/config
).
inspector
is a CLI tool and a Kubernetes plugin for running Cluster and Ingress Conroller diagnostics, collecting Cluster and Ingress Controller logs and generating reports.
-
Install Go binary
go install github.com/qba73/inspector/cmd/inspector@latest
-
Get help:
inspector -h
Usage: inspector [-v] [-h] [-n] <namespace> Collect K8s and NIC diagnostics in the given namespace In verbose mode (-v), prints out progess, steps and all data points to stdout.
-
Collect data points from
default
namespaceinspector -n default > default.json
-
Collect data points from
nginx-ingress
namespaceinspector -n nginx-ingress > nginx-ingress.json
-
Clone the repo.
-
Build inspector.
go build -o kubectl-inspector ./cmd/inspector/main.go
-
Copy the binary to a dir in your
$HOME
, for example:cp kubectl-inspector /usr/local/bin/
-
Verify if the
kubectl
discovers the plugin:kubectl plugin list
[...] /usr/local/bin/kubectl-inspector
-
Verify
inspector
can be run usingkubectl
:kubectl inspector -h Usage: inspector [-h] [-v] [-n] namespace Collect K8s and Ingress Controller diagnostics in the given namespace. In verbose mode (-v), prints out progess, steps and all data points to stdout.
-
Collect data points from
default
namespaceNote that
inspector
's default namespace isdefault
.kubectl inspector > default.json
-
Collect data points from
nginx-ingress
namespacekubectl inspector -n nginx-ingress > nginx-ingress.json
The program collects K8s cluster and NGINX Ingress Controller diagnostics data. It prints out data in the JSON format to the stdout. This allows the output to be piped to other tools (for example jq) for further parsing and processing.
Currently inspector
collects following data points:
- K8s version
- K8s cluster id
- Number of nodes in the cluster
- K8s platform name
- Pods
- Logs from pods
- Events
- ConfigMaps
- Services
- Deployments
- StatefulSets
- ReplicaSets
- Leases
- CRDs
- IngressClasses
- Ingresses
- IngressAnnotations
Planned:
- Nodes metrics
- Ingress Controller stats, options and configuration
Future releases will add support for collecting K8s Gateway API diagnostics.
If you'd like to contribute to Inspector, please read the Contributing guide.
Gopher image by Gopherize.me