From 59b4dc71733209d00625e0ed2f342417fd09d998 Mon Sep 17 00:00:00 2001 From: Trevor Tao Date: Wed, 23 Oct 2019 21:13:56 +0800 Subject: [PATCH] Force overwrite the k8s config file Force overwrite the k8s config file in user environment in case that the Kubernetes had ever been installed before. Signed-off-by: Trevor Tao Change-Id: Ic11ac998666e97f1b5457084744f57da0436d274 Signed-off-by: Trevor Tao --- src/foundation/scripts/k8s_master.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/foundation/scripts/k8s_master.sh b/src/foundation/scripts/k8s_master.sh index ab9a289..cdcf8bc 100755 --- a/src/foundation/scripts/k8s_master.sh +++ b/src/foundation/scripts/k8s_master.sh @@ -1,4 +1,5 @@ #!/bin/bash -ex +# shellcheck source=/dev/null # For host setup as Kubernetes master MGMT_IP=$1 @@ -25,7 +26,8 @@ if ! kubectl get nodes; then fi mkdir -p "${HOME}/.kube" - sudo cp /etc/kubernetes/admin.conf "${HOME}/.kube/config" + # shellcheck disable=SC2216 + yes | sudo cp -rf /etc/kubernetes/admin.conf "${HOME}/.kube/config" sudo chown "$(id -u)":"$(id -g)" "${HOME}/.kube/config" sleep 5 -- 2.16.6