The commands that cover almost everything in modules 1 to 7.
look
# state and detail kubectl get pods -A -o wide kubectl get pods -l app=checkout kubectl describe pod NAME kubectl get events --sort-by=.lastTimestamp kubectl logs NAME -c app --previous # cluster kubectl get nodes -o wide kubectl describe node NODE kubectl get --raw='/readyz?verbose' kubectl api-resources
change
kubectl apply -f x.yaml kubectl diff -f x.yaml kubectl rollout status deploy/NAME kubectl rollout undo deploy/NAME kubectl scale deploy/NAME --replicas=5 kubectl taint nodes N k=v:NoSchedule kubectl drain NODE --ignore-daemonsets kubectl cordon NODE kubectl label pod NAME tier=web kubectl create job x --from=cronjob/NAME
network and storage
kubectl get svc,endpointslices kubectl get netpol -A kubectl run dbg -it --rm \ --image=nicolaka/netshoot -- bash kubectl get ingress,gateway,httproute -A kubectl get pv,pvc,sc kubectl describe pvc NAME kubectl get volumesnapshot -A kubectl auth can-i create pods -n shop kubectl config get-contexts
Output tricks
-o yaml, -o json | jq, -o jsonpath='{.items[*].metadata.name}', --watch, --show-labels.
Always
Check the context first. Use --dry-run=server and kubectl diff before applying to production.