tldr/pages/common/kubectl.md

37 lines
802 B
Markdown
Raw Normal View History

2018-01-30 15:51:25 +00:00
# kubectl
> Command line interface for running commands against Kubernetes clusters.
2019-06-05 08:55:49 +01:00
> More information: <https://kubernetes.io/docs/tasks/tools/install-kubectl>.
2018-01-30 15:51:25 +00:00
- List all pods in all namespaces:
`kubectl get pods --all-namespaces`
- List all pods with more information (such as node name):
`kubectl get pods -o wide`
- Update specified pod with the label 'unhealthy' and the value 'true':
`kubectl label pods {{name}} unhealthy=true`
- List all resources with different types:
`kubectl get all`
- Show metrics for all nodes:
`kubectl top node`
- Show metrics for all pods in the default namespace:
`kubectl top pod`
- Print the address of the master and cluster services:
`kubectl cluster-info`
- Display an explanation of the specific field:
`kubectl explain pods.spec.containers`