Kubernetes: List all objects using get-all plugin

2 min read | by Jordi Prats

If we need to take a look at the resources of a Kubernetes cluster, by using kubectl get all we won't be able to see all the resources. Most notably, it won't list Ingress objects. You can take a look at this issue for kubectl for the details but we won't be able to get all the resources using this command, we'll have to install the get-all krew plugin

Installing the plugin is as straightforward as:

$ kubectl krew install get-all

Once we have the plugin installed it is a first-class citizen, we can invoke it using kubectl get-all

$ kubectl get-all
NAME                                                                                                        NAMESPACE            AGE
componentstatus/scheduler                                                                                                        <unknown>  
componentstatus/controller-manager                                                                                               <unknown>  
componentstatus/etcd-0                                                                                                           <unknown>       
configmap/aws-load-balancer-controller-leader                                                               alb-controller       15d        
configmap/kube-root-ca.crt                                                                                  alb-controller       15d        
configmap/cluster-autoscaler-status                                                                         autoscaler           2d17h      
configmap/kube-root-ca.crt                                                                                  autoscaler           76d             
configmap/kube-root-ca.crt                                                                                  default              80d        
configmap/kube-root-ca.crt                                                                                  external-dns         6d23h      
configmap/pet2cattle-sonarqube-commands                                                                     pet2cattle           41h        
configmap/pet2cattle-sonarqube-config                                                                       pet2cattle           41h        
configmap/pet2cattle-sonarqube-jmx-config                                                                   pet2cattle           41h        
configmap/kube-root-ca.crt                                                                                  pet2cattle           41h            

We can check the --help output for the exact options but we can use the most common options with get-all such as filtering by namespace:

$ kubectl get-all -n kube-system
W0902 16:53:00.357252  106128 warnings.go:70] extensions/v1beta1 Ingress is deprecated in v1.14+, unavailable in v1.22+; use networking.k8s.io/v1 Ingress
NAME                                                                                     NAMESPACE    AGE
configmap/coredns                                                                        kube-system  58m  
configmap/extension-apiserver-authentication                                             kube-system  59m  
configmap/kube-proxy                                                                     kube-system  58m  

And the label selector:

$ kubectl get-all -l component=etcd
NAME               NAMESPACE    AGE
pod/etcd-minikube  kube-system  63m  

Posted on 14/09/2021