Kubectl Commands Cheat Sheet by PhoenixNAP
Kubectl Commands Cheat Sheet by PhoenixNAP
kubectl get namespaces Generate a plain-text list of kubectl describe nodes See details about a kubectl logs [pod-name] Print logs from a pod
all namespaces [node-name] particular node
kubectl logs -f [pod-name] Stream logs from a pod
kubectl get pods Generate a plain-text list of kubectl describe pods See details about a
all pods [pod-name] particular pod
Resource Types - Short Names
kubectl get pods -o wide Generate a detailed Kubectl describe –f pod.json See details about a pod
plain-text list of all pods whose name and type are
listed in pod.json Short name Full name
kubectl get pods Generate a list of all pods
--field-selector=spec. running on a particular kubectl describe pods See details about all pods csr certificatesigningrequests
nodeName=[server-name] node server [replication-controller-name] managed by a specific
replication controller
cs componentstatuses
kubectl get List a specific replication
replicationcontroller controller in plain text kubectl describe pods See details about all pods
[replication-controller- cm configmaps
name]
ds daemonsets
Deleting Resources
kubectl get Generate a plain-text list of
replicationcontroller, all replication controllers deploy deployments
services and services kubectl delete -f pod.yaml Remove a pod using the
name and type listed in
ep endpoints
kubectl get deamonset Generate a plain-text list of pod.yaml:
all daemon sets
kubectl delete pods,services Remove all the pods and ev events
-l [label-key]=[label-value] services with a specific
label: hpa horizontalpodautoscalers
Creating a Resource
kubectl delete pods --all Remove all pods. The ing ingresses
kubectl create namespace Create a new namespace command will include
[namespace-name] uninitialized pods as well
limits limitranges