From: Trevor Tao Date: Wed, 23 Oct 2019 13:13:56 +0000 (+0800) Subject: Force overwrite the k8s config file X-Git-Tag: 2.0.0-AKRAINO~7 X-Git-Url: https://gerrit.akraino.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F29%2F1829%2F4;p=iec.git 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 --- 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