Skip to content

Instantly share code, notes, and snippets.

@ipedrazas
Last active February 28, 2018 09:56
Show Gist options
  • Save ipedrazas/e156a459f0f8a36ded8c5e3b9cde790c to your computer and use it in GitHub Desktop.
Save ipedrazas/e156a459f0f8a36ded8c5e3b9cde790c to your computer and use it in GitHub Desktop.
kube set context the heptio way
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