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 ##############################################################################
17 PATH_OF_EDGECORE="/etc/kubeedge-v1.1.0-linux-amd64/edge/edgecore"
19 initialize_k8s_cluster()
28 curl -L "https://github.com/kubeedge/kubeedge/releases/download/${VERSION}/kubeedge-${VERSION}-${OS}-${ARCH}.tar.gz" \
29 --output kubeedge-${VERSION}-${OS}-${ARCH}.tar.gz && sudo tar -xf kubeedge-${VERSION}-${OS}-${ARCH}.tar.gz -C /etc
35 echo "generate_certs started"
36 wget -L https://raw.githubusercontent.com/kubeedge/kubeedge/master/build/tools/certgen.sh
39 bash -x ./certgen.sh genCertAndKey edge
41 echo "generate_certs ended"
47 echo "initalize_yaml started"
48 wget -L https://raw.githubusercontent.com/kubeedge/kubeedge/master/build/crds/devices/devices_v1alpha1_devicemodel.yaml
50 chmod +x devices_v1alpha1_devicemodel.yaml
52 kubectl create -f devices_v1alpha1_devicemodel.yaml
54 wget -L https://raw.githubusercontent.com/kubeedge/kubeedge/master/build/crds/devices/devices_v1alpha1_device.yaml
56 chmod +x devices_v1alpha1_device.yaml
57 kubectl create -f devices_v1alpha1_device.yaml
58 echo "initialize_yaml ended"
65 echo "cloudcore_start started"
66 cp controller.yaml /etc/kubeedge-${VERSION}-${OS}-${ARCH}/cloud/cloudcore/conf/controller.yaml
67 cd /etc/kubeedge-${VERSION}-${OS}-${ARCH}/cloud/cloudcore
68 nohup ./cloudcore > cloudcore.log 2>&1 &
69 echo "cloudcore_start ended"
74 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
75 #rm -rf /etc/kubeedge-${VERSION}-${OS}-${ARCH}/edge/conf/edge.yaml
76 mv /etc/kubeedge-${VERSION}-${OS}-${ARCH}/edge/conf/edge_new.yaml /etc/kubeedge-${VERSION}-${OS}-${ARCH}/edge/conf/edge.yaml
82 echo "exec_edge started"
84 sshpass -p ${EDGENODEPASSWORD} \
86 scp -r $KUBEEDGE_ETC \
87 ${EDGENODEUSR}@${EDGENODEIP}:/etc
89 sshpass -p ${EDGENODEPASSWORD} \
90 scp -r $KUBEEDGE_VERSION_ETC \
91 ${EDGENODEUSR}@${EDGENODEIP}:/etc
93 sshpass -p ${EDGENODEPASSWORD} ssh ${EDGENODEUSR}@${EDGENODEIP} \
94 nohup $PATH_OF_EDGECORE > edgecore.log 2>&1 &
95 echo "exec_edge ended"
100 echo "apply_node_json started"
101 kubectl apply -f node.json
102 echo "apply_node_json ended"
108 source config_kubeedge
109 initialize_k8s_cluster
111 # sleep added for k8s kube-system pods to be up
123 exec_edge > /dev/null 2>&1
127 echo "Kubeedge-v1.1.0 installation completed"