Quick post to list kubectl commands to view and change contexts, as I had to search around quite a bit.
kubectl config current-context
kubectl config get-contexts # display list of contexts
kubectl config use-context your-cluster-name # set the default context to your-cluster-name
function change-context() { if [ "$1" = "dev" ]; then kubectl config use-context your-dev-cluster-name elif [ "$1" = "stage" ]; then kubectl config use-context your-staging-cluster-name elif [ "$1" = "prod" ]; then kubectl config use-context your-prod-cluster-name fi }
For more Kubectl context and configuration options, click here.
The source code for this website can be found here under an MIT license