Skip to content

Instantly share code, notes, and snippets.

@artipixel
Created December 4, 2022 09:40
Show Gist options
  • Save artipixel/930f4b375db1c93cd3dd232bd3594219 to your computer and use it in GitHub Desktop.
Save artipixel/930f4b375db1c93cd3dd232bd3594219 to your computer and use it in GitHub Desktop.
Kubernetes tools and shortcuts
# Shortcuts for Kubectl
alias k='kubectl'
alias kgp='kubectl get pods'
alias kgd='kubectl get deployments'
alias kgs='kubectl get services'
alias kgi='kubectl get ingress'
alias kuc='kubectl config use-context'
# context example
alias kdev='kuc dev'
alias kdata='kuc data'
alias kprod='kuc prod'
# Add the current context to the info line
# Put this at the end of the file
prompt_kubecontext() {
prompt_segment white black "k8s-`kubectl config current-context`/`kubectl config get-contexts --no-headers | grep '*' | awk '{print $5}'`"
}
## Main prompt
build_prompt() {
RETVAL=$?
prompt_status
prompt_dir
prompt_git
prompt_kubecontext
prompt_end
}
PROMPT='%{%f%b%k%}$(build_prompt) '
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment