KubeEdge Note

From ESS-WIKI
Jump to: navigation, search

Introduction

KubeEdge is an open source system extending native containerized application orchestration and device management to hosts at the Edge. It is built upon Kubernetes and provides core infrastructure support for networking, application deployment and metadata synchronization between cloud and edge. It also supports MQTT and allows developers to author custom logic and enable resource constrained device communication at the Edge. KubeEdge consists of a cloud part and an edge part.



Project

KubeEdge on GitHub


How To

Prerequisites

  • Docker - Cloud / Edge
  • Kubeadm/kubectl - Cloud only
  • Create cluster with kubeadm - Cloud only
Set up "GO" 
$curl -O  https://dl.google.com/go/go1.9.7.linux-amd64.tar.gz
$sudo tar -xvf go1.9.7.linux-amd64.tar.gz
$sudo mv go /usr/local
$sudo vim ~/.profile
PATH="$HOME/bin:$HOME/.local/bin:$PATH:/usr/local/go/bin

Build KubeEdge

$mkdir KubeEdge
$export GOPATH=/home/adv/work/KubeEdge
$git clone https://github.com/kubeedge/kubeedge.git $GOPATH/src/github.com/kubeedge/kubeedge
$cd $GOPATH/src/github.com/kubeedge/kubeedge
$make

Configuring MQTT mode

  1. internalMqttMode: internal mqtt broker is enabled.
  2. bothMqttMode: internal as well as external broker are enabled.
  3. externalMqttMode: only external broker is enabled.

Generate Certificates

$GOPATH/src/github.com/kubeedge/kubeedge/build/tools/certgen.sh genCertAndKey edge

The cert/key will be generated in the /etc/kubeedge/ca and /etc/kubeedge/certs respectively.

Run Cloud

Certificates:

The path to the generated certificates should be updated in $GOPATH/src/github.com/kubeedge/kubeedge/cloud/edgecontroller/conf/controller.yaml. Please update the correct paths for the following :

  • cloudhub.ca
  • cloudhub.cert
  • cloudhub.key
cd $GOPATH/src/github.com/kubeedge/kubeedge/cloud/edgecontroller

./edgecontroller

  • You need to create a node on k8s master ( Cloud )
kubectl apply -f $GOPATH/src/github.com/kubeedge/kubeedge/build/node.json

Run Edge

Certificates:

$GOPATH/src/github.com/kubeedge/kubeedge/edge/conf/edge.yaml

  • websocket:URL
  • controller:node-id
  • edged:hostname-override
$sudo ./edge_core

Note: need sudo Permission

Check status

$kubectl get nodes     

To check the node ( Edge ) has created in the cluster 

Deploy Application

$kubectl apply -f $GOPATH/src/github.com/kubeedge/kubeedge/build/deployment.yaml
$kubectl get pods

Download

KubeEdge Introduction