Skip to content

Instantly share code, notes, and snippets.

@mgoodness
Last active May 28, 2019 15:44
Show Gist options
  • Save mgoodness/c0b0f887c962ef050d5411efb3befc9a to your computer and use it in GitHub Desktop.
Save mgoodness/c0b0f887c962ef050d5411efb3befc9a to your computer and use it in GitHub Desktop.
kube-context() {
if [[ -n "$1" ]]; then
context=$1
else
context=$(kubectl config get-contexts \
| fzf --header-lines=1 --no-multi \
| awk '{if ($1!="*") print $1; else print $2 }')
fi
[[ -n ${context} ]] && kubectl config use-context ${context}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment