Skip to content

A CLI tool to display all API resources & their categories in a Kubernetes cluster.

License

Notifications You must be signed in to change notification settings

tohjustin/kube-api-categories

Repository files navigation

kube-api-categories

build release kubernetes compatibility license

A CLI tool to display all API categories & resources in a Kubernetes cluster.

Usage

$ kube-api-categories
RESOURCE                          APIGROUP                       NAMESPACED   CATEGORIES
bindings                                                         true         []
componentstatuses                                                false        []
configmaps                                                       true         []
endpoints                                                        true         []
events                                                           true         []
limitranges                                                      true         []
namespaces                                                       false        []
nodes                                                            false        []
persistentvolumeclaims                                           true         []
persistentvolumes                                                false        []
pods                                                             true         [all]
podtemplates                                                     true         []
replicationcontrollers                                           true         [all]
resourcequotas                                                   true         []
secrets                                                          true         []
serviceaccounts                                                  true         []
services                                                         true         [all]
mutatingwebhookconfigurations     admissionregistration.k8s.io   false        [api-extensions]
validatingwebhookconfigurations   admissionregistration.k8s.io   false        [api-extensions]
customresourcedefinitions         apiextensions.k8s.io           false        [api-extensions]
...

View list of available API categories

$ kube-api-categories --output=category
all
api-extensions
apim-istio-io
cert-manager
cert-manager-acme
constraint
constraints
networking-istio-io
policy-istio-io
prometheus-operator
rbac-istio-io
security-istio-io
telemetry-istio-io

View resources in a specific API category

$ kube-api-categories --output=resource --categories=all
cronjobs.batch
daemonsets.apps
deployments.apps
horizontalpodautoscalers.autoscaling
jobs.batch
pods
replicasets.apps
replicationcontrollers
services
statefulsets.apps

$ kube-api-categories --output=resource --categories=prometheus-operator
alertmanagerconfigs.monitoring.coreos.com
alertmanagers.monitoring.coreos.com
podmonitors.monitoring.coreos.com
probes.monitoring.coreos.com
prometheuses.monitoring.coreos.com
prometheusrules.monitoring.coreos.com
servicemonitors.monitoring.coreos.com
thanosrulers.monitoring.coreos.com

Flags

Flags for configuring relationship discovery parameters

Flag Description
--api-group='' Limit to resources in the specified API group
--cached=false Use the cached list of resources if available
--categories=[] Limit to resources that belong to the specified categories
--namespaced=true If false, non-namespaced resources will be returned,
otherwise returning namespaced resources by default.
--no-headers=false When using the default output format, don't print headers (default print headers)
--output='', -o Output format. One of: category|resource.

Use the following commands to view the full list of supported flags

$ kube-api-categories --help

Installation

Install via krew

The tool is available via the tohjustin/kubectl-plugins custom plugin index

$ kubectl krew index add tohjustin https://github.com/tohjustin/kubectl-plugins.git
$ kubectl krew install tohjustin/api-categories

$ kubectl api-categories --version

Install from Source

$ git clone [email protected]:tohjustin/kube-api-categories.git && cd kube-api-categories
$ make install

$ kube-api-categories --version