kubernetes
kubernetes

Get Resources from K8S Cluster using Kubectl cmd:

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

To get the resource of the objects within Kubernetes Cluster: 

To get pod from namespace kuberneteslab: 

$ kubectl get pod -n kuberneteslab 

If you do not specify the namespace then you will get the result from “default” namespace.

To get deployment from namespace kuberneteslab: 

 $ kubectl get deployment -n kuberneteslab 

To get replicasets from namespace kuberneteslab: 

$ kubectl get replicaset -n kuberneteslab 

To get service from namespace kuberneteslab: 

 $ kubectl get service -n kuberneteslab 

To get persistent volume from namespace kuberneteslab: 

 $ kubectl get pv -n kuberneteslab

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

At Kuberneteslab, we aim for writing the articles based on open source technologies. We hope our article helped you.

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments