This repository contains a script to generate hundreds of convenient kubectl aliases programmatically.
Some of the 800 generated aliases are:
alias k='kubectl'
alias kg='kubectl get'
alias kgpo='kubectl get pod'
alias ksysgpo='kubectl --namespace=kube-system get pod'
alias krm='kubectl delete'
alias krmf='kubectl delete -f'
alias krming='kubectl delete ingress'
alias krmingl='kubectl delete ingress -l'
alias krmingall='kubectl delete ingress --all-namespaces'
alias kgsvcoyaml='kubectl get service -o=yaml'
alias kgsvcwn='kubectl get service --watch --namespace'
alias kgsvcslwn='kubectl get service --watch --show-labels --namespace'
alias kgwf='kubectl get --watch -f'
...See the full list.
You can directly download the .kubectl_aliases file
and save it in your $HOME directory, then edit your .bashrc/.zshrc file with:
[ -f ~/.kubectl_aliases ] && source ~/.kubectl_aliasesPrint the full command before running it: Add this to your .bashrc or
.zshrc file:
function kubectl() { echo "+ kubectl $@"; command kubectl $@; }k=kubectlsys=--namespace kube-system
- commands:
g=getd=describerm=deletea:apply -fex:exec -i -tlo:logs -f
- resources:
po=pod,dep=deployment,ing=ingress,svc=service,cm=configmap,sec=secret,ns=namespace,no=node
- flags:
- output format:
oyaml,ojson,owide all:--allor--all-namespacesdepending on the commandsl:--show-labelsw=-w/--watch
- output format:
- value flags (should be at the end):
f=-f/--filenamel=-l/--selector
Does this not slow down my shell start up? Sourcing the file that contains
~500 aliases takes about 30-45 milliseconds in my shell (zsh). I don't think
it's a big deal for me. Measure it with echo $(($(date +%s%N)/1000000))
command yourself in your .bashrc/.zshrc.
This is not an official Google project.