Install required tools
brew install fzf
brew install kubectx
brew install stern
brew install kube-ps1
brew install kubecolor/tap/kubecolor
brew install kubernetes-cli
brew install octant
Change your shell into zsh (should be the case since High Sierra)
chsh -s /bin/zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
NOTE: the installer will rename an existing .zshrc file to .zshrc.pre-oh-my-zsh.
Enable some plugins in your .zshrc (look for plugins)
plugins=(brew kubectl git python zsh-completions)
Add these lines at the end of your .zshrc
source <(stern --completion=zsh)
alias kubectl=kubecolor
# make completion work with kubecolor
compdef kubecolor=kubectl
Add this to the end of your .zshrc
KUBE_PS1_PREFIX=""
KUBE_PS1_SUFFIX=""
KUBE_PS1_SYMBOL_ENABLE=false
source "/opt/homebrew/opt/kube-ps1/share/kube-ps1.sh"
RPROMPT='$(kube_ps1) %{$fg[green]%}[%*]%{$reset_color%}'
This theme is a 2 lines theme giving you space to type:
ZSH_THEME="tjkirch"
You can then switch context with kubectx
.
kubectl
is aliased to k
, type k get po <tab>
Use everywhere you want completion on any Kubernetes attributes, works with the CRD as well: k get <tab>
will show you all CRDs.
To tail the logs for all pods of the same deployment stern auth-gen -n auth-generator-api --since 1m
.
For a web experience to the cluster use octant
.
More tools https://cloud-native-canada.github.io/k8s_setup_tools/