diff --git a/cluster/kubectl.sh b/cluster/kubectl.sh index c4e9886d02d..2945c88afa9 100755 --- a/cluster/kubectl.sh +++ b/cluster/kubectl.sh @@ -100,25 +100,12 @@ elif [[ ! -x "${KUBECTL_PATH}" ]]; then fi kubectl="${KUBECTL_PATH:-${kubectl}}" -# While GKE requires the kubectl binary, it's actually called through -# gcloud. But we need to adjust the PATH so gcloud gets the right one. +# GKE stores it's kubeconfig in a separate location. if [[ "$KUBERNETES_PROVIDER" == "gke" ]]; then detect-project &> /dev/null - export PATH=$(get_absolute_dirname $kubectl):$PATH - kubectl="${GCLOUD}" - # GKE runs kubectl through gcloud. config=( - "alpha" - "container" - "kubectl" - "--project=${PROJECT}" - "--zone=${ZONE}" - "--cluster=${CLUSTER_NAME}" - ) -elif [[ "$KUBERNETES_PROVIDER" == "vagrant" ]]; then - # When we are using vagrant it has hard coded kubeconfig, and do not clobber public endpoints - config=( - "--kubeconfig=$HOME/.kubernetes_vagrant_kubeconfig" + "--kubeconfig=${HOME}/.config/gcloud/kubernetes/kubeconfig" + "--context=gke_${PROJECT}_${ZONE}_${CLUSTER_NAME}" ) fi diff --git a/hack/local-up-cluster.sh b/hack/local-up-cluster.sh index 85e22c2e39d..a947cea1468 100755 --- a/hack/local-up-cluster.sh +++ b/hack/local-up-cluster.sh @@ -176,8 +176,8 @@ Logs: To start using your cluster, open up another terminal/tab and run: - cluster/kubectl.sh config set-cluster local --server=http://${API_HOST}:${API_PORT} --insecure-skip-tls-verify=true --global - cluster/kubectl.sh config set-context local --cluster=local --global + cluster/kubectl.sh config set-cluster local --server=http://${API_HOST}:${API_PORT} --insecure-skip-tls-verify=true + cluster/kubectl.sh config set-context local --cluster=local cluster/kubectl.sh config use-context local cluster/kubectl.sh EOF