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