Last active
February 28, 2018 09:56
-
-
Save ipedrazas/e156a459f0f8a36ded8c5e3b9cde790c to your computer and use it in GitHub Desktop.
kube set context the heptio way
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kubectl config set-cluster volume --server=https://api.volume.mydmain.com --insecure-skip-tls-verify=true | |
kubectl config set-context volume --cluster=volume --user=myuser | |
kubectl config set-credentials myuser --token=$KUBERNETES_TOKEN | |
kubectl config use-context volume | |
kubectl create namespace ks-dev | |
CURRENT_CONTEXT=$(kubectl config current-context) | |
CURRENT_CLUSTER=$(kubectl config get-contexts $CURRENT_CONTEXT | tail -1 | awk '{print $3}') | |
CURRENT_USER=$(kubectl config get-contexts $CURRENT_CONTEXT | tail -1 | awk '{print $4}') | |
kubectl config set-context ks-dev \ | |
--namespace ks-dev \ | |
--cluster $CURRENT_CLUSTER \ | |
--user $CURRENT_USER | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment