Code Review
/
iec.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Add 2 committers to IEC Type1&2
[iec.git]
/
src
/
foundation
/
scripts
/
k8s_master.sh
diff --git
a/src/foundation/scripts/k8s_master.sh
b/src/foundation/scripts/k8s_master.sh
index
82fc79b
..
67eecf5
100755
(executable)
--- a/
src/foundation/scripts/k8s_master.sh
+++ b/
src/foundation/scripts/k8s_master.sh
@@
-1,7
+1,10
@@
#!/bin/bash -ex
#!/bin/bash -ex
+# shellcheck source=/dev/null
# For host setup as Kubernetes master
# For host setup as Kubernetes master
-MGMT_IP=$1
+# Use the src of the default route as the default local IP
+DEF_SRC_IP=$(ip route get 8.8.8.8 | awk '{ for (nn=1;nn<=NF;nn++) if ($nn~"src") print $(nn+1) }')
+MGMT_IP=${1:-${DEF_SRC_IP}}
POD_NETWORK_CIDR=${2:-192.168.0.0/16}
SERVICE_CIDR=${3:-172.16.1.0/24}
POD_NETWORK_CIDR=${2:-192.168.0.0/16}
SERVICE_CIDR=${3:-172.16.1.0/24}
@@
-22,9
+25,13
@@
if ! kubectl get nodes; then
tee -a "${HOME}/.bashrc"
# shellcheck disable=SC1090
source "${HOME}/.bashrc"
tee -a "${HOME}/.bashrc"
# shellcheck disable=SC1090
source "${HOME}/.bashrc"
- else
- mkdir -p "${HOME}/.kube"
- sudo cp -i /etc/kubernetes/admin.conf "${HOME}/.kube/config"
- sudo chown "$(id -u)":"$(id -g)" "${HOME}/.kube/config"
fi
fi
+
+ mkdir -p "${HOME}/.kube"
+ # 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
+ sudo swapon -a
fi
fi