2 ##############################################################################
3 # Copyright (c) 2019 Huawei Tech and others.
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9 ##############################################################################
11 echo "**********************************************************************"
12 echo "Kubeedge-v1.1.0 Installation------------------------------------------STARTED"
20 PATH_OF_EDGECORE="/etc/kubeedge-v1.1.0-linux-amd64/edge/edgecore"
22 initialize_k8s_cluster()
26 cp /etc/kubernetes/admin.conf /root/.kube/config
34 curl -L "https://github.com/kubeedge/kubeedge/releases/download/${VERSION}/kubeedge-${VERSION}-${OS}-${ARCH}.tar.gz" \
35 --output kubeedge-${VERSION}-${OS}-${ARCH}.tar.gz && sudo tar -xf kubeedge-${VERSION}-${OS}-${ARCH}.tar.gz -C /etc
41 echo "generate_certs started"
42 wget -L https://raw.githubusercontent.com/kubeedge/kubeedge/master/build/tools/certgen.sh
45 bash -x ./certgen.sh genCertAndKey edge
47 echo "generate_certs ended"
53 echo "initalize_yaml started"
54 wget -L https://raw.githubusercontent.com/kubeedge/kubeedge/master/build/crds/devices/devices_v1alpha1_devicemodel.yaml
56 chmod +x devices_v1alpha1_devicemodel.yaml
58 kubectl create -f devices_v1alpha1_devicemodel.yaml
60 wget -L https://raw.githubusercontent.com/kubeedge/kubeedge/master/build/crds/devices/devices_v1alpha1_device.yaml
62 chmod +x devices_v1alpha1_device.yaml
63 kubectl create -f devices_v1alpha1_device.yaml
64 echo "initialize_yaml ended"
71 echo "cloudcore_start started"
72 cp controller.yaml /etc/kubeedge-${VERSION}-${OS}-${ARCH}/cloud/cloudcore/conf/controller.yaml
73 cd /etc/kubeedge-${VERSION}-${OS}-${ARCH}/cloud/cloudcore
74 nohup ./cloudcore > cloudcore.log 2>&1 &
75 echo "cloudcore_start ended"
80 sed "s/0.0.0.0/${MASTERNODEIP}/" /etc/kubeedge-${VERSION}-${OS}-${ARCH}/edge/conf/edge.yaml > /etc/kubeedge-${VERSION}-${OS}-${ARCH}/edge/conf/edge_new.yaml
81 #rm -rf /etc/kubeedge-${VERSION}-${OS}-${ARCH}/edge/conf/edge.yaml
82 mv /etc/kubeedge-${VERSION}-${OS}-${ARCH}/edge/conf/edge_new.yaml /etc/kubeedge-${VERSION}-${OS}-${ARCH}/edge/conf/edge.yaml
88 echo "exec_edge started"
90 sshpass -p ${EDGENODEPASSWORD} \
91 scp -r $KUBEEDGE_ETC \
92 ${EDGENODEUSR}@${EDGENODEIP}:/etc
94 sshpass -p ${EDGENODEPASSWORD} \
95 scp -r $KUBEEDGE_VERSION_ETC \
96 ${EDGENODEUSR}@${EDGENODEIP}:/etc
98 sshpass -p ${EDGENODEPASSWORD} ssh ${EDGENODEUSR}@${EDGENODEIP} \
99 nohup $PATH_OF_EDGECORE > edgecore.log 2>&1 &
100 echo "exec_edge ended"
105 echo "apply_node_json started"
107 cd ${PATH_OF_KUBEEDGE}
108 kubectl apply -f node.json
109 echo "apply_node_json ended"
115 source config_kubeedge
116 initialize_k8s_cluster
118 # sleep added for k8s kube-system pods to be up
130 exec_edge > /dev/null 2>&1
134 echo "Kubeedge-v1.1.0 Installation------------------------------------------SUCCESS"
135 echo "************************************************************************"