Skip to content

K8s Mini Manual

Philip Fourie edited this page Apr 13, 2020 · 14 revisions

Index

Code completion

source <(kubectl completion bash) # setup autocomplete in bash into the current shell, bash-completion package should be installed first.
echo "source <(kubectl completion bash)" >> ~/.bashrc # add autocomplete permanently to your bash shell.

alias k=kubectl
complete -F __start_kubectl k

https://kubernetes.io/docs/reference/kubectl/cheatsheet/

Various commands

kubectl logs <pod-name> -c <container-name>
kubectl top nodes
kubectl top pods

kubectl get pods --all-namespaces

# Update pod settings while running
kubectl edit pod <pod-name> -n <namespace>

# Export current spec without state, useful to make edits to pod when not allowed while running
kubectl get pod <pod-name> -n <name-space> -o yaml --export
Clone this wiki locally