<mohammadrony>

Kubectl Get

Resources

Core components

kubectl get componentstatuses

Nodes

kubectl get no
kubectl get nodes

Namespace

kubectl get ns
kubectl get namespace

Pods

kubectl get pod
kubectl get pods

Deployment

kubectl get deploy
kubectl get deployment

Service

kubectl get svc
kubectl get service

Statefulset

kubectl get sts
kubectl get statefulset

Auto scaler

kubectl get hpa
kubectl get horizontalpodautoscaler

Service account

kubectl get sa
kubectl get serviceaccount

Role

kubectl get role

Role binding

kubectl get rb
kubectl get rolebinding

Options

kubectl get ... -o OUTPUT
kubectl get ... -n NAMESPACE
kubectl get ... -l KEY=VALUE
kubectl get ... --sort-by='FIELD'
kubectl get ... --field-selector spec.nodeName=<node>

Examples

kubectl get ... -o name
kubectl get ... --no-headers

Examples

Get all namespace pods

kubectl get pods --all-namespaces

Sort by field

kubectl get pods --sort-by=cpu
kubectl get pods --sort-by=.metadata.name

Pods for specific node

kubectl get pods --all-namespaces -o wide --field-selector spec.nodeName=<node>

Custom fields for resource (e.g: node,taints)

kubectl get nodes --output custom-columns=NODE_NAME:.metadata.name,TAINTS:.spec.taints