Update hack/create-cluster.sh

Co-authored-by: Kevin Wang <kevinwzf0126@gmail.com>
This commit is contained in:
Hongcai Ren 2020-11-26 20:40:58 +08:00 committed by Kevin Wang
parent 6df7f16ee3
commit bd1d7d6129
1 changed files with 1 additions and 1 deletions

View File

@ -34,6 +34,6 @@ kind create cluster --name "${CLUSTER_NAME}" --kubeconfig="${KUBECONFIG}" --wait
kubectl config rename-context "kind-${CLUSTER_NAME}" "${CLUSTER_NAME}" --kubeconfig="${KUBECONFIG}"
# Kind cluster uses `127.0.0.1` as kube-apiserver endpoint by default, thus kind clusters can't reach each other.
# So we need to update endpoint with docker IP.
# So we need to update endpoint with container IP.
docker_ip=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' "${CLUSTER_NAME}-control-plane")
kubectl config set-cluster "${CLUSTER_NAME}" --server="https://${docker_ip}:6443" --kubeconfig="${KUBECONFIG}"