▶ Saving time

Kubectl autocomplete


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.


source <(kubectl completion zsh)  # setup autocomplete in zsh into the current shell
echo "[[ $commands[kubectl] ]] && source <(kubectl completion zsh)" >> ~/.zshrc # add autocomplete permanently to your zsh shell

Kubectl aliases

Put aliases in ~/.zshrc or ~/.bashrc:

alias k="kubectl"
alias kp="kubectl get pods"
alias kd="kubectl get deployment"
alias ks="kubectl get service"
alias kn="kubectl get nodes"
alias kdp="kubectl describe pod"
alias kdd="kubectl describe deployment"
alias kds="kubectl describe service"

▶ Manifest files

Create your own manifest files using --dry-run and outputting to a file:

kubectl run nginx \
--image=nginx \
--restart=Never \
--dry-run -o yaml > nginx.yml

▶ Ask for help

kubectl run --help | grep kubectl

▶ Documentation

More help available during the journey by using the documentation at kubernetes.io.

So know your way around the ‘Tasks’ and ‘Concepts’ section of the documentation found here:



▶ Cheatsheet

Get to know kubectl by studying the cheatsheet: