How to get resources from Kubernetes Cluster using Kubectl ?

Jakir Patel
Nov 19, 2021

This post is sponsored by Kuberneteslab. Kuberneteslab helps startups to manage the horizontal layer of the application lifecycle. It includes DevOps + BCP + App modernization.

In this article we will look into some commands to get resources from Kubernetes cluster using Kubectl.

To get the resource of particular type:

To get pod:

$ kubectl get pod -n namespace

To get deployment:
$ kubectl get deployment -n namespace

To get replicasets:
$ kubectl get replicaset -n namespace

To get service:
$ kubectl get service -n namespace

To get persistent volume:
$ kubectl get pv -n namespace

To get from all namespaces :
$ kubectl get po -A

You can use -A option with rest of Kubernetes object too.

To get all resources from all namespaces:
$ kubectl get all -A

--

--