2 #Install the k8s-master & k8s-worker node from Mgnt node
7 # Displays the help menu.
10 echo "Usage: $0 [master ip] [worker ip] [user] [password] "
12 echo "There should be an user which will be used to install the "
13 echo "corresponding software on master & worker node. This user can "
14 echo "run the sudo command without input password on the hosts."
16 echo "Example usages:"
17 echo " ./startup.sh 10.169.40.171 10.169.41.172 iec 123456"
23 # Deploy k8s with calico.
28 INSTALL_SOFTWARE="sudo apt-get update && sudo apt-get install -y git &&\
29 sudo rm -rf ~/.kube ~/iec &&\
30 git clone ${REPO_URL} &&\
31 cd iec/src/foundation/scripts/ && source k8s_common.sh"
33 #Automatic deploy the K8s environments on Master node
34 SETUP_MASTER="cd iec/src/foundation/scripts/ && source k8s_master.sh ${K8S_MASTER_IP}"
35 sshpass -p ${K8S_MASTERPW} ssh ${HOST_USER}@${K8S_MASTER_IP} ${INSTALL_SOFTWARE}
36 sshpass -p ${K8S_MASTERPW} ssh ${HOST_USER}@${K8S_MASTER_IP} ${SETUP_MASTER} | tee kubeadm.log
38 KUBEADM_JOIN_CMD=$(grep "kubeadm join " ./kubeadm.log)
40 #Automatic deploy the K8s environments on Worker node
41 SETUP_WORKER="cd iec/src/foundation/scripts/ && source k8s_worker.sh"
42 sshpass -p ${K8S_WORKERPW} ssh ${HOST_USER}@${K8S_WORKER01_IP} ${INSTALL_SOFTWARE}
43 sshpass -p ${K8S_WORKERPW} ssh ${HOST_USER}@${K8S_WORKER01_IP} "echo \"sudo ${KUBEADM_JOIN_CMD}\" >> ./iec/src/foundation/scripts/k8s_worker.sh"
44 sshpass -p ${K8S_WORKERPW} ssh ${HOST_USER}@${K8S_WORKER01_IP} ${SETUP_WORKER}
46 #Deploy etcd & CNI from master node
47 #There may be more options in future. e.g: Calico, Contiv-vpp, Ovn-k8s ...
48 SETUP_CNI="cd iec/src/foundation/scripts && source setup-cni.sh"
49 sshpass -p ${K8S_MASTERPW} ssh ${HOST_USER}@${K8S_MASTER_IP} ${SETUP_CNI}
53 # Check the K8s environments
58 VERIFY_K8S="cd iec/src/foundation/scripts/ && source nginx.sh"
59 sshpass -p ${K8S_MASTERPW} ssh ${HOST_USER}@${K8S_MASTER_IP} ${VERIFY_K8S}
68 K8S_MASTER_IP=${1:-"10.169.40.171"}
69 K8S_MASTERPW=${PASSWD}
71 K8S_WORKER01_IP=${2:-"10.169.41.172"}
72 K8S_WORKERPW=${PASSWD}
74 REPO_URL="https://gerrit.akraino.org/r/iec"
75 LOG_FILE="kubeadm.log"
77 if [ -f "./${LOG_FILE}" ]; then