Kubectl
View Kubernetes resources with kubectl
The standard Kubernetes command line tool,
kubectl
, is a flexible way to inspect the active resources in an account. Here are some useful commands for viewing resources. kubectl get pods
kubectl get pods --namespace the-namespace
kubectl get pods --all-namespaces
kubectl get pods -o wide
kubectl describe pods
kubectl describe pod the-pod
kubectl get pod the-pod -o yaml
List the number of CPUs, GPUs, and memory requested by each Pod.
Note: This assumes
jq
is installed.kubectl get pods -o json | jq '.items[] | {name: .metadata.name, cpu: .spec.containers[].resources.requests.cpu, gpu: .spec.containers[].resources.requests."nvidia.com/gpu", memory: .spec.containers[].resources.requests.memory}'
kubectl get vs
kubectl get services
kubectl get services --namespace the-namespace
kubectl get services --sort-by=.metadata.name
kubectl get deployments
kubectl get deployment the-deployment
Last modified 19d ago