Programmatically generated handy kubectl aliases.
Switch branches/tags
Nothing to show
Clone or download
freele and ahmetb Alias's uncovering fix (#10)
* Alias's uncovering fix

* fix: to single line
Latest commit e0454df Jun 21, 2018


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_aliases

Print the full command before running it: Add this to your .bashrc or .zshrc file:

function kubectl() { echo "+ kubectl $@"; command kubectl $@; }

Syntax explanation

  • k=kubectl
    • sys=--namespace kube-system
  • commands:
    • g=get
    • d=describe
    • rm=delete
    • a:apply -f
    • ex: exec -i -t
    • lo: 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: --all or --all-namespaces depending on the command
    • sl: --show-labels
    • w=-w/--watch
  • value flags (should be at the end):
    • f=-f/--filename
    • l=-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.