2020-10-05 16:08:22 +01: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`
|
|
|
|
|
2023-12-27 06:22:49 +00:00
|
|
|
- Get nodes in a specified [n]amespace:
|
2020-10-05 16:08:22 +01:00
|
|
|
|
2023-12-27 06:22:49 +00:00
|
|
|
`kubectl get nodes --namespace {{namespace}}`
|
2020-10-05 16:08:22 +01:00
|
|
|
|
2023-12-27 06:22:49 +00:00
|
|
|
- Get pods in a specified [n]amespace:
|
2020-10-05 16:08:22 +01:00
|
|
|
|
2023-12-27 06:22:49 +00:00
|
|
|
`kubectl get pods --namespace {{namespace}}`
|
2020-10-05 16:08:22 +01:00
|
|
|
|
2023-12-27 06:22:49 +00:00
|
|
|
- Get deployments in a specified [n]amespace:
|
2020-10-05 16:08:22 +01:00
|
|
|
|
2023-12-27 06:22:49 +00:00
|
|
|
`kubectl get deployments --namespace {{namespace}}`
|
2020-10-05 16:08:22 +01:00
|
|
|
|
2023-12-27 06:22:49 +00:00
|
|
|
- Get services in a specified [n]amespace:
|
2020-10-05 16:08:22 +01:00
|
|
|
|
2023-12-27 06:22:49 +00:00
|
|
|
`kubectl get services --namespace {{namespace}}`
|
2020-10-05 16:08:22 +01:00
|
|
|
|
2023-12-27 06:22:49 +00:00
|
|
|
- Get all resources in a specified [n]amespace:
|
2021-10-24 03:20:43 +01:00
|
|
|
|
2023-12-27 06:22:49 +00:00
|
|
|
`kubectl get all --namespace {{namespace}}`
|
2021-10-24 03:20:43 +01:00
|
|
|
|
2023-12-27 06:22:49 +00:00
|
|
|
- Get Kubernetes objects defined in a YAML manifest [f]ile:
|
2020-10-05 16:08:22 +01:00
|
|
|
|
2023-12-27 06:22:49 +00:00
|
|
|
`kubectl get --file {{path/to/manifest.yaml}}`
|