Skip to content

Instantly share code, notes, and snippets.

@matheusneder
Last active July 30, 2018 14:20
Show Gist options
  • Save matheusneder/fe090b73f0e71b89eb56a35b822ae43e to your computer and use it in GitHub Desktop.
Save matheusneder/fe090b73f0e71b89eb56a35b822ae43e to your computer and use it in GitHub Desktop.
#!/bin/bash
NAMESPACE=$1
if [ -z $NAMESPACE ]
then
echo "Usage: $0 namespace"
exit 1
fi
if ! kubectl get namespace | grep $NAMESPACE > /dev/null 2>&1
then
echo "Namespace '$NAMESPACE' not found" >> /dev/stderr
exit 1
fi
kubectl config set-context $(kubectl config current-context) --namespace=$NAMESPACE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment