--- /dev/null
+#!/bin/bash -ex
+
+##############################################################################
+# Copyright (c) 2019 Huawei Tech and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+# This script is to install common software for ELIOT.
+# To be executed in Eliot Manager and Eliot Nodes.
+# Script will install Docker software.
+# Script has to be executed in Ubuntu 16.04.
+
+# Set Docker version
+DOCKER_VERSION=18.06.1~ce~3-0~ubuntu
+
+sudo apt-get update && sudo apt-get install -y git
+
+# Install Docker as Prerequisite
+curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
+sudo apt-key fingerprint 0EBFCD88
+sudo add-apt-repository \
+ "deb https://download.docker.com/linux/ubuntu \
+ $(lsb_release -cs) \
+ stable"
+
+sudo apt update
+sudo apt install -y docker-ce=${DOCKER_VERSION}
+
--- /dev/null
+EDGENODEUSR=""
+EDGENODEIP=""
+EDGENODEPASSWORD=""
+MASTERNODEIP=""
+HOME_EDGENODE="/root"
+KUBEEDGE_ETC="/etc/kubeedge"
+KUBEEDGE_VERSION_ETC="/etc/kubeedge-v1.1.0-linux-amd64/"
+PATH_OF_KUBEEDGE=":/root/eliot/blueprints/iotgateway/scripts/kubeedge"
--- /dev/null
+controller:
+ kube:
+ master: # kube-apiserver address (such as:http://localhost:8080)
+ namespace: ""
+ content_type: "application/vnd.kubernetes.protobuf"
+ qps: 5
+ burst: 10
+ node_update_frequency: 10
+ kubeconfig: "/root/.kube/config"
+cloudhub:
+ protocol_websocket: true # enable websocket protocol
+ port: 10000 # open port for websocket server
+ protocol_quic: true # enable quic protocol
+ quic_port: 10001 # open prot for quic server
+ max_incomingstreams: 10000 # the max incoming stream for quic server
+ enable_uds: true # enable unix domain socket protocol
+ uds_address: unix:///var/lib/kubeedge/kubeedge.sock
+ address: 0.0.0.0
+ ca: /etc/kubeedge/ca/rootCA.crt
+ cert: /etc/kubeedge/certs/edge.crt
+ key: /etc/kubeedge/certs/edge.key
+ keepalive-interval: 30
+ write-timeout: 30
+ node-limit: 10
+devicecontroller:
+ kube:
+ master: # kube-apiserver address (such as:http://localhost:8080)
+ namespace: ""
+ content_type: "application/vnd.kubernetes.protobuf"
+ qps: 5
+ burst: 10
+ kubeconfig: "/root/.kube/config"
--- /dev/null
+#!/bin/bash -ex
+##############################################################################
+# Copyright (c) 2019 Huawei Tech and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+KUBE_VERSION=1.16.0-00
+POD_NETWORK_CIDR=192.168.0.0/16
+K8S_CNI_VERSION=0.7.5-00
+
+#K8s service CIDR range
+K8s_SVC_CIDR=10.96.0.0/12
+
+# Install Kubernetes with Kubeadm
+
+# Disable swap
+sudo swapoff -a
+sudo apt update
+sudo apt install -y apt-transport-https curl
+curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
+
+cat <<EOF | sudo tee /etc/apt/sources.list.d/kubernetes.list
+deb https://apt.kubernetes.io/ kubernetes-xenial main
+EOF
+
+sudo apt update
+sudo apt install -y \
+ kubernetes-cni=${K8S_CNI_VERSION} kubelet=${KUBE_VERSION} \
+ kubeadm=${KUBE_VERSION} kubectl=${KUBE_VERSION}
+
+sudo apt-mark hold kubelet kubeadm kubectl
+
+if ! kubectl get nodes; then
+ hostname -I > hostname.tmp
+ MASTER_IP="$(cut -d ' ' -f 1 hostname.tmp)"
+ rm hostname.tmp
+ sudo kubeadm config images pull
+ sudo kubeadm init \
+ --apiserver-advertise-address="${MASTER_IP}" \
+ --pod-network-cidr="${POD_NETWORK_CIDR}" \
+ --service-cidr="${K8s_SVC_CIDR}"
+
+ if [ "$(id -u)" = 0 ]; then
+ KUBECONFIG=/etc/kubernetes/admin.conf
+ echo "export KUBECONFIG=/etc/kubernetes/admin.conf" | \
+ tee -a "${HOME}/.profile"
+ source "${HOME}/.profile"
+ 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
+ #kubectl apply -f "cni/calico/v38/calico.yaml"
+
+fi
--- /dev/null
+#!/bin/bash -ex
+##############################################################################
+# Copyright (c) 2019 Huawei Tech and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+# constants
+
+VERSION="v1.1.0"
+OS="linux"
+ARCH="amd64"
+
+PATH_OF_EDGECORE="/etc/kubeedge-v1.1.0-linux-amd64/edge/edgecore"
+
+initialize_k8s_cluster()
+{
+ source common.sh
+ source k8smaster.sh
+}
+
+kubeedge_tar_untar()
+{
+
+ curl -L "https://github.com/kubeedge/kubeedge/releases/download/${VERSION}/kubeedge-${VERSION}-${OS}-${ARCH}.tar.gz" \
+ --output kubeedge-${VERSION}-${OS}-${ARCH}.tar.gz && sudo tar -xf kubeedge-${VERSION}-${OS}-${ARCH}.tar.gz -C /etc
+
+}
+
+generate_certs()
+{
+ echo "generate_certs started"
+ wget -L https://raw.githubusercontent.com/kubeedge/kubeedge/master/build/tools/certgen.sh
+
+ chmod +x certgen.sh
+ bash -x ./certgen.sh genCertAndKey edge
+
+ echo "generate_certs ended"
+
+}
+
+initialize_yaml()
+{
+ echo "initalize_yaml started"
+ wget -L https://raw.githubusercontent.com/kubeedge/kubeedge/master/build/crds/devices/devices_v1alpha1_devicemodel.yaml
+
+ chmod +x devices_v1alpha1_devicemodel.yaml
+
+ kubectl create -f devices_v1alpha1_devicemodel.yaml
+
+ wget -L https://raw.githubusercontent.com/kubeedge/kubeedge/master/build/crds/devices/devices_v1alpha1_device.yaml
+
+ chmod +x devices_v1alpha1_device.yaml
+ kubectl create -f devices_v1alpha1_device.yaml
+ echo "initialize_yaml ended"
+}
+
+# Run cloudcore
+
+cloudcore_start()
+{
+ echo "cloudcore_start started"
+ cp controller.yaml /etc/kubeedge-${VERSION}-${OS}-${ARCH}/cloud/cloudcore/conf/controller.yaml
+ cd /etc/kubeedge-${VERSION}-${OS}-${ARCH}/cloud/cloudcore
+ nohup ./cloudcore > cloudcore.log 2>&1 &
+ echo "cloudcore_start ended"
+}
+
+edge_modify()
+{
+ 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
+ #rm -rf /etc/kubeedge-${VERSION}-${OS}-${ARCH}/edge/conf/edge.yaml
+ mv /etc/kubeedge-${VERSION}-${OS}-${ARCH}/edge/conf/edge_new.yaml /etc/kubeedge-${VERSION}-${OS}-${ARCH}/edge/conf/edge.yaml
+
+}
+
+exec_edge()
+{
+ echo "exec_edge started"
+
+ sshpass -p ${EDGENODEPASSWORD} \
+
+ scp -r $KUBEEDGE_ETC \
+ ${EDGENODEUSR}@${EDGENODEIP}:/etc
+
+ sshpass -p ${EDGENODEPASSWORD} \
+ scp -r $KUBEEDGE_VERSION_ETC \
+ ${EDGENODEUSR}@${EDGENODEIP}:/etc
+
+ sshpass -p ${EDGENODEPASSWORD} ssh ${EDGENODEUSR}@${EDGENODEIP} \
+ nohup $PATH_OF_EDGECORE > edgecore.log 2>&1 &
+ echo "exec_edge ended"
+}
+
+apply_node_json()
+{
+ echo "apply_node_json started"
+ kubectl apply -f node.json
+ echo "apply_node_json ended"
+}
+
+
+
+# start
+source config_kubeedge
+initialize_k8s_cluster
+
+# sleep added for k8s kube-system pods to be up
+
+sleep 240
+
+kubeedge_tar_untar
+
+generate_certs
+
+initialize_yaml
+
+cloudcore_start
+edge_modify
+exec_edge > /dev/null 2>&1
+
+apply_node_json
+
+echo "Kubeedge-v1.1.0 installation completed"
--- /dev/null
+{
+ "kind": "Node",
+ "apiVersion": "v1",
+ "metadata": {
+ "name": "edge-node",
+ "labels": {
+ "name": "edge-node",
+ "node-role.kubernetes.io/edge": ""
+ }
+ }
+}