Force overwrite the k8s config file 29/1829/4
authorTrevor Tao <trevor.tao@arm.com>
Wed, 23 Oct 2019 13:13:56 +0000 (21:13 +0800)
committerTrevor Tao <trevor.tao@arm.com>
Wed, 23 Oct 2019 14:41:31 +0000 (22:41 +0800)
Force overwrite the k8s config file in user environment in case
that the Kubernetes had ever been installed before.

Signed-off-by: Trevor Tao <trevor.tao@arm.com>
Change-Id: Ic11ac998666e97f1b5457084744f57da0436d274
Signed-off-by: Trevor Tao <trevor.tao@arm.com>
src/foundation/scripts/k8s_master.sh

index ab9a289..cdcf8bc 100755 (executable)
@@ -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