Setup KubeEdge



To use KubeEdge, make sure you have docker in your environment, if don’t have, please reference the following steps to install docker.

Install docker

For ubuntu:

# Install Docker from Ubuntu's repositories:
apt-get update
apt-get install -y

# or install Docker CE 18.06 from Docker's repositories for Ubuntu or Debian:
apt-get update && apt-get install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL | apt-key add -
add-apt-repository \
   "deb [arch=amd64] \
   $(lsb_release -cs) \
apt-get update && apt-get install docker-ce=18.06.0~ce~3-0~ubuntu

For centOS:

# Install Docker from CentOS/RHEL repository:
yum install -y docker

# or install Docker CE 18.06 from Docker's CentOS repositories:
yum install yum-utils device-mapper-persistent-data lvm2
yum-config-manager \
    --add-repo \
yum update && yum install docker-ce-18.06.1.ce

KubeEdge uses MQTT for communication between deviceTwin and devices. KubeEdge supports 3 MQTT modes:

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

Use mode field in edge.yaml to select the desired mode

To use kubeedge in double mqtt or external mode, make sure you have mosquitto in your environment. Please reference the following steps to install mosquitto if it is not already present in your environment.

Install mosquitto

For ubuntu:

apt install mosquitto

For centOS:

yum install mosquitto

See mosquitto official website for more information.


Clone kube-edge

git clone $GOPATH/src/
cd $GOPATH/src/
make # or `make -C edge edgecore`

Integrate with HuaweiCloud Intelligent EdgeFabric (IEF)

The HuaweiCloud IEF is only available in China now.
  1. Create an account in HuaweiCloud.
  2. Go to IEF and create an Edge node.
  3. Download the node configuration file (.tar.gz).
  4. Run bash -x hack/ /PATH/TO/<node_name>.tar.gz to modify the configuration files in conf/.


# run mosquitto
mosquitto -d -p 1883

# run edgecore
# `conf/` should be in the same directory as the binary
# or
nohup ./edgecore > edgecore.log 2>&1 &

If you are using HuaweiCloud IEF, then the edge node you created should be running (check it in the IEF console page).

Run Unit Tests

 make test

To run unit tests of a package individually

 cd <path to package to be tested>
 go test -v