HiveBrain v1.2.0
Get Started
← Back to all entries
snippetbashTip

kubectl — Run commands against Kubernetes clusters. Some subcommands such as `run` have their own usage docume

Submitted by: @import:tldr-pages··
0
Viewed 0 times
commandruncommandsclikubectlkubernetesclustersagainst

Problem

How to use the kubectl command: Run commands against Kubernetes clusters. Some subcommands such as run have their own usage documentation. More information: <https://kubernetes.io/docs/reference/kubectl/>.

Solution

kubectl — Run commands against Kubernetes clusters. Some subcommands such as run have their own usage documentation. More information: <https://kubernetes.io/docs/reference/kubectl/>.

List information about a resource with more details:
kubectl get {{pods|service|deployment|ingress|...}} {{[-o|--output]}} 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 {{pods|nodes}}


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 /}}

Code Snippets

List information about a resource with more details

kubectl get {{pods|service|deployment|ingress|...}} {{[-o|--output]}} 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 {{pods|nodes}}

Print the address of the master and cluster services

kubectl cluster-info

Context

tldr-pages: common/kubectl

Revisions (0)

No revisions yet.