Skip to content

Instantly share code, notes, and snippets.

@zepptron
Created January 4, 2018 14:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zepptron/a78e4e58324c75dbe1170671262f1109 to your computer and use it in GitHub Desktop.
Save zepptron/a78e4e58324c75dbe1170671262f1109 to your computer and use it in GitHub Desktop.
bashrc for faster interaction with kubernetes
## ENVs ##
red=`tput setaf 1`
green=`tput setaf 2`
yellow=`tput setaf 3`
reset=`tput sgr0`
alias ll="ls -lah"
alias k="kubectl"
source <(kubectl completion bash)
function k-sys() {
alias k="kubectl --namespace kube-system"
printf "\n${red}kubectl --namespace kube-system active\n\n${reset}"
}
function k-pub() {
alias k="kubectl --namespace kube-public"
printf "\n${green}kubectl --namespace kube-public active\n\n${reset}"
}
function k-def() {
alias k="kubectl"
printf "\n${green}kubectl without namespace active\n\n${reset}"
}
function k-nodes() {
for i in kube-{1..3}; do
printf "${yellow}item: $i:${reset}\n"
kubectl describe node $i.foo.io | grep -A4 "Allocated resources:"
done
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment