2020-10-05 08:08:22 -07:00
|
|
|
# kubectl get
|
|
|
|
|
|
|
|
> Get Kubernetes objects and resources.
|
|
|
|
> More information: <https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#get>.
|
|
|
|
|
|
|
|
- Get all namespaces in the current cluster:
|
|
|
|
|
|
|
|
`kubectl get namespaces`
|
|
|
|
|
2025-03-28 05:26:23 +02:00
|
|
|
- Get nodes in a specified namespace:
|
2020-10-05 08:08:22 -07:00
|
|
|
|
2025-03-28 05:26:23 +02:00
|
|
|
`kubectl get nodes {{[-n|--namespace]}} {{namespace}}`
|
2020-10-05 08:08:22 -07:00
|
|
|
|
2025-03-28 05:26:23 +02:00
|
|
|
- Get pods in a specified namespace:
|
2020-10-05 08:08:22 -07:00
|
|
|
|
2025-03-28 05:26:23 +02:00
|
|
|
`kubectl get pods {{[-n|--namespace]}} {{namespace}}`
|
2020-10-05 08:08:22 -07:00
|
|
|
|
2025-03-28 05:26:23 +02:00
|
|
|
- Get deployments in a specified namespace:
|
2020-10-05 08:08:22 -07:00
|
|
|
|
2025-03-28 05:26:23 +02:00
|
|
|
`kubectl get deployments {{[-n|--namespace]}} {{namespace}}`
|
2020-10-05 08:08:22 -07:00
|
|
|
|
2025-03-28 05:26:23 +02:00
|
|
|
- Get services in a specified namespace:
|
2020-10-05 08:08:22 -07:00
|
|
|
|
2025-03-28 05:26:23 +02:00
|
|
|
`kubectl get services {{[-n|--namespace]}} {{namespace}}`
|
2020-10-05 08:08:22 -07:00
|
|
|
|
2025-03-28 05:26:23 +02:00
|
|
|
- Get all resources in a specified namespace:
|
2021-10-23 19:20:43 -07:00
|
|
|
|
2025-03-28 05:26:23 +02:00
|
|
|
`kubectl get all {{[-n|--namespace]}} {{namespace}}`
|
2021-10-23 19:20:43 -07:00
|
|
|
|
2025-03-28 05:26:23 +02:00
|
|
|
- Get Kubernetes objects defined in a YAML manifest file:
|
2020-10-05 08:08:22 -07:00
|
|
|
|
2025-03-28 05:26:23 +02:00
|
|
|
`kubectl get {{[-f|--file]}} {{path/to/manifest.yaml}}`
|