1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-04-22 10:02:10 +02:00
tldr/pages/common/kubectl.md
Steven Pitts 5a17971b1c
kubectl: add kubectl describe in header (#5032)
https://github.com/tldr-pages/tldr/pull/4494 added `kubectl describe` help, but the main page still doesn't mention it. Add a note about its usage.

This is an important command, but it exceeds the suggested limit of 8 examples (do subcommands count as "examples"?). We could instead replace the `kubectl get` example with `kubectl {{get|describe}}`, but I'm really not a fan of that, since they're two different subcommands.
2020-12-19 19:20:46 +00:00

965 B

kubectl

Command line interface for running commands against Kubernetes clusters. See also kubectl describe and other pages for additional information. More information: https://kubernetes.io/docs/reference/kubectl/.

  • List information about a resource with more details:

kubectl get {{pod|service|deployment|ingress|...}} -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

  • Display resource (CPU/Memory/Storage) usage of nodes or pods:

kubectl top {{pod|node}}

  • Print the address of the master and cluster services:

kubectl cluster-info

  • Display an explanation of a specific field:

kubectl explain {{pods.spec.containers}}

  • Print the logs for a container in a pod or specified resource:

kubectl logs {{pod_name}}

  • Run command in an existing pod:

kubectl exec {{pod_name}} -- {{ls /}}