From: srinivasan.s.n@huawei.com Date: Tue, 28 May 2019 10:59:12 +0000 (+0000) Subject: kubeedge setup script X-Git-Url: https://gerrit.akraino.org/r/gitweb?a=commitdiff_plain;h=27e9f5fb9f12ba20b1b45e322d2bcfcae5b0da6f;hp=-c;p=eliot.git kubeedge setup script Change-Id: I3bf02a3714892208dd7440a7edd5ac63f606d7c0 --- 27e9f5fb9f12ba20b1b45e322d2bcfcae5b0da6f diff --git a/scripts/src/config_kubeedge b/scripts/src/config_kubeedge new file mode 100644 index 0000000..2d11960 --- /dev/null +++ b/scripts/src/config_kubeedge @@ -0,0 +1,6 @@ +edgenodeusr="root" +edgenodeip="10.10.0.54" +edgenodepassword="Huawei@akraino" +masternodeusr="root" +masternodeip="10.10.0.45" +masternodepassword="Huawei@akraino" diff --git a/scripts/src/kubeedge_setup.sh b/scripts/src/kubeedge_setup.sh index b79416f..6cfc2c3 100755 --- a/scripts/src/kubeedge_setup.sh +++ b/scripts/src/kubeedge_setup.sh @@ -11,20 +11,26 @@ take_keedge(){ git clone https://github.com/kubeedge/kubeedge.git $GOPATH/src/github.com/kubeedge/kubeedge + source ~/.profile cd $GOPATH/src/github.com/kubeedge/kubeedge/keadm make - + #kubectl apply -f https://docs.projectcalico.org/v3.3/getting-started/kubernetes/installation/hosted/rbac-kdd.yaml + #kubectl apply -f https://docs.projectcalico.org/v3.3/getting-started/kubernetes/installation/hosted/rbac-kdd.yaml } -common_steps="git clone https://github.com/kubeedge/kubeedge.git $GOPATH/src/github.com/kubeedge/kubeedge &&\ -cd $GOPATH/src/github.com/kubeedge/kubeedge/keadm &&\ -make &&\ +source config_kubeedge +common_steps="git clone https://github.com/kubeedge/kubeedge.git $GOPATH/src/github.com/kubeedge/kubeedge && \ +source ~/.profile && \ +cd $GOPATH/src/github.com/kubeedge/kubeedge/keadm && \ +make && \ chmod +x kubeedge" certif_copy="cd /etc/kubeedge &&\ scp certs.tar.gz" -edge_start="kubeedge join --edgecontrollerip=${nodeip} --edgenodeid=eliot_edge_01" +edge_start="cd $GOPATH/src/github.com/kubeedge/kubeedge/keadm && \ +chmod +x kubeedge && \ +./kubeedge join --edgecontrollerip=$masternodeip --edgenodeid=eliotedge02 --k8sserverip=$masternodeip:8080" execute_keedge_controller(){ cd $GOPATH/src/github.com/kubeedge/kubeedge/keadm @@ -33,30 +39,38 @@ execute_keedge_controller(){ } -# start +exec_edge(){ -take_keedge + cd $HOME/eliot/scripts/src + sshpass -p ${edgenodepassword} scp $HOME/release/eliot/scripts/src/config_kubeedge ${edgenodeusr}@${edgenodeip}:/root -execute_keedge_controller + sshpass -p ${edgenodepassword} ssh ${edgenodeusr}@${edgenodeip} \ + source config_kubeedge + + source config_kubeedge + sshpass -p ${edgenodepassword} ssh ${edgenodeusr}@${edgenodeip} ${common_steps} < /dev/null +echo "after common_steps" + sshpass -p ${edgenodepassword} scp /etc/kubeedge/certs.tgz ${edgenodeusr}@${edgenodeip}:/etc/kubeedge -while read line -do - nodeinfo="${line}" - nodeusr=$(echo ${nodeinfo} | cut -d"|" -f1) - nodeip=$(echo ${nodeinfo} | cut -d"|" -f2) - nodepaswd=$(echo ${nodeinfo} | cut -d"|" -f3) - masternodeip=$(echo ${nodeinfo} | cut -d"|" -f3) + sshpass -p ${edgenodepassword} \ + ssh ${edgenodeusr}@${edgenodeip} \ + tar -xvzf /etc/kubeedge/certs.tgz --directory /etc/kubeedge + + sshpass -p ${edgenodepassword} ssh ${edgenodeusr}@${edgenodeip} ${edge_start} < /dev/null +} - sshpass -p ${nodepaswd} ssh ${nodeusr}@${nodeip} ${common_steps} < /dev/null - sshpass -p ${nodepaswd} scp /etc/kubeedge/certs.tar.gz ${nodeusr}@${nodepaswd}:/etc/kubeedge +# start - sshpass -p ${nodepaswd} \ - tar -xvzf /etc/kubeedge/certs.tgz +source config_kubeedge +#sample +#return +take_keedge - sshpass -p ${nodepaswd} ssh ${nodeusr}@${nodeip} kubeedge join --edgecontrollerip=${masternodeip} --edgenodeid=eliot_edge_01 \ - --k8sserverip=${masternodeip}:8080 -done < nodelist +execute_keedge_controller +#sample +#execute_edge +exec_edge kubectl get nodes kubectl create -f deployment.yaml diff --git a/scripts/src/nodelist b/scripts/src/nodelist deleted file mode 100644 index 1ebba28..0000000 --- a/scripts/src/nodelist +++ /dev/null @@ -1 +0,0 @@ -|||||