Skip to content

Instantly share code, notes, and snippets.

@rrichards
Forked from mgoodness/kube-context.sh
Created May 28, 2019 15:44
Show Gist options
  • Save rrichards/429731269298e38ef969ef06d946964e to your computer and use it in GitHub Desktop.
Save rrichards/429731269298e38ef969ef06d946964e 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