Getting Started with KubeEdge Installer

Please refer to KubeEdge Installer proposal document for details on the motivation of having KubeEdge Installer. It also explains the functionality of the proposed commands. KubeEdge Installer Doc

Limitation

  • Currently support of KubeEdge installer is available only for Ubuntu OS. CentOS support is in-progress.

Downloading KubeEdge Installer

  1. Go to KubeEdge Release page and download keadm-$VERSION-$OS-$ARCH.tar.gz..
  2. Untar it at desired location, by executing tar -xvzf keadm-$VERSION-$OS-$ARCH.tar.gz.
  3. kubeedge folder is created after execution the command.

Building from source

  1. Download the source code either by
  • git clone https://github.com/kubeedge/kubeedge.git $GOPATH/src/github.com/kubeedge/kubeedge
  1. cd $GOPATH/src/github.com/kubeedge/kubeedge/keadm
  2. make
  3. Binary keadm is available in current path

Installing KubeEdge Master Node (on the Cloud) component

Referring to KubeEdge Installer Doc, the command to install KubeEdge cloud component (edge controller) and pre-requisites. Port 8080, 6443 and 10000 in your cloud component needs to be accessible for your edge nodes.

  • Execute keadm init

Command flags

The optional flags with this command are mentioned below

  1. $ keadm init --help
  2. keadm init command bootstraps KubeEdge's cloud component.
  3. It checks if the pre-requisites are installed already,
  4. If not installed, this command will help in download,
  5. install and execute on the host.
  6. Usage:
  7. keadm init [flags]
  8. Examples:
  9. keadm init
  10. Flags:
  11. --docker-version string[="18.06.0"] Use this key to download and use the required Docker version (default "18.06.0")
  12. -h, --help help for init
  13. --kubeedge-version string[="0.3.0-beta.0"] Use this key to download and use the required KubeEdge version (default "0.3.0-beta.0")
  14. --kubernetes-version string[="1.14.1"] Use this key to download and use the required Kubernetes version (default "1.14.1")
  1. --docker-version, if mentioned with any version > 18.06.0, will install the same on the host. Default is 18.06.0. It is optional.
  2. --kubernetes-version, if mentioned with any version > 1.14.1, will install the same on the host. Default is 1.14.1. It is optional. It will install kubeadm, kubectl and kubelet in this host.
  3. --kubeedge-version, if mentioned with any version > 0.2.1, will install the same on the host. Default is 0.3.0-beta.0. It is optional.

command format is

  1. keadm init --docker-version=<expected version> --kubernetes-version=<expected version> --kubeedge-version=<expected version>

NOTE: Version mentioned as defaults for Docker and K8S are being tested with.

Installing KubeEdge Worker Node (at the Edge) component

Referring to KubeEdge Installer Doc, the command to install KubeEdge Edge component (edge core) and pre-requisites

  • Execute keadm join <flags>

Command flags

The optional flags with this command are shown in below shell

  1. $ keadm join --help
  2. "keadm join" command bootstraps KubeEdge's edge component.
  3. It checks if the pre-requisites are installed already,
  4. If not installed, this command will help in download,
  5. to install the prerequisites.
  6. It will help the edge node to connect to the cloud.
  7. Usage:
  8. keadm join [flags]
  9. Examples:
  10. keadm join --cloudcoreip=<ip address> --edgenodeid=<unique string as edge identifier>
  11. - For this command --cloudcoreip flag is a Mandatory flag
  12. - This command will download and install the default version of pre-requisites and KubeEdge
  13. keadm join --cloudcoreip=10.20.30.40 --edgenodeid=testing123 --kubeedge-version=0.2.1 --k8sserverip=50.60.70.80:8080
  14. - In case, any option is used in a format like as shown for "--docker-version" or "--docker-version=", without a value
  15. then default values will be used.
  16. Also options like "--docker-version", and "--kubeedge-version", version should be in
  17. format like "18.06.3" and "0.2.1".
  18. Flags:
  19. --docker-version string[="18.06.0"] Use this key to download and use the required Docker version (default "18.06.0")
  20. -e, --cloudcoreip string IP address of KubeEdge cloudcore
  21. -i, --edgenodeid string KubeEdge Node unique identification string, If flag not used then the command will generate a unique id on its own
  22. -h, --help help for join
  23. -k, --k8sserverip string IP:Port address of K8S API-Server
  24. --kubeedge-version string[="0.3.0-beta.0"] Use this key to download and use the required KubeEdge version (default "0.3.0-beta.0")
  1. For KubeEdge flag the functionality is same as mentioned in keadm init
  2. -k, –k8sserverip, It should be in the format IPAddress:Port, where the default port is 8080. Please see the example above.

IMPORTANT NOTE: The KubeEdge version used in cloud and edge side should be same.

Reset KubeEdge Master and Worker nodes

Referring to KubeEdge Installer Doc, the command to stop KubeEdge cloud (edge controller). It doesn’t uninstall/remove any of the pre-requisites.

  • Execute keadm reset

Command flags

  1. keadm reset --help
  2. keadm reset command can be executed in both cloud and edge node
  3. In master node it shuts down the cloud processes of KubeEdge
  4. In worker node it shuts down the edge processes of KubeEdge
  5. Usage:
  6. keadm reset [flags]
  7. Examples:
  8. For master node:
  9. keadm reset
  10. For worker node:
  11. keadm reset --k8sserverip 10.20.30.40:8080
  12. Flags:
  13. -h, --help help for reset
  14. -k, --k8sserverip string IP:Port address of cloud components host/VM

Simple steps to bring up KubeEdge setup and deploy a pod

NOTE: All the below steps are executed as root user, to execute as sudo user ,Please add sudo infront of all the commands

1. Deploy KubeEdge CloudCore (With K8s Cluster)

Install tools with the particular version

  1. keadm init --kubeedge-version=<kubeedge Version> --kubernetes-version=<kubernetes Version> --docker-version=<Docker version>

Install tools with the default version

  1. keadm init --kubeedge-version= --kubernetes-version= --docker-version
  2. or
  3. keadm init

NOTE: On the console output, observe the below line

kubeadm join 192.168.20.134:6443 –token 2lze16.l06eeqzgdz8sfcvh –discovery-token-ca-cert-hash sha256:1e5c808e1022937474ba264bb54fea42b05eddb9fde2d35c9cad5b83cf5ef9acAfter Kubeedge init ,please note the cloudIP as highlighted above generated from console output and port is 8080.

2. Manually copy certs.tgz from cloud host to edge host(s)

On edge host

  1. mkdir -p /etc/kubeedge

On cloud host

  1. cd /etc/kubeedge/
  2. scp -r certs.tgz username@ipEdgevm:/etc/kubeedge

On edge host untar the certs.tgz file

  1. cd /etc/kubeedge
  2. tar -xvzf certs.tgz

3. Deploy KubeEdge edge core

Install tools with the particular version

  1. keadm join --cloudcoreip=<cloudIP> --edgenodeid=<unique string as edge identifier> --k8sserverip=<cloudIP>:8080 --kubeedge-version=<kubeedge Version> --docker-version=<Docker version>

Install tools with the default version

  1. keadm join --cloudcoreip=<cloudIP> --edgenodeid=<unique string as edge identifier> --k8sserverip=<cloudIP>:8080 --kubeedge-version=<kubeedge Version> --docker-version=<Docker version>

Sample execution output:

  1. # ./keadm join --cloudcoreip=192.168.20.50 --edgenodeid=testing123 --k8sserverip=192.168.20.50:8080
  2. Same version of docker already installed in this host
  3. Host has mosquit+ already installed and running. Hence skipping the installation steps !!!
  4. Expected or Default KubeEdge version 0.3.0-beta.0 is already downloaded
  5. kubeedge/
  6. kubeedge/edge/
  7. kubeedge/edge/conf/
  8. kubeedge/edge/conf/modules.yaml
  9. kubeedge/edge/conf/logging.yaml
  10. kubeedge/edge/conf/edge.yaml
  11. kubeedge/edge/edgecore
  12. kubeedge/cloud/
  13. kubeedge/cloud/cloudcore
  14. kubeedge/cloud/conf/
  15. kubeedge/cloud/conf/controller.yaml
  16. kubeedge/cloud/conf/modules.yaml
  17. kubeedge/cloud/conf/logging.yaml
  18. kubeedge/version
  19. KubeEdge Edge Node: testing123 successfully add to kube-apiserver, with operation status: 201 Created
  20. Content {"kind":"Node","apiVersion":"v1","metadata":{"name":"testing123","selfLink":"/api/v1/nodes/testing123","uid":"87d8d7a3-7acd-11e9-b86b-286ed488c645","resourceVersion":"3864","creationTimestamp":"2019-05-20T07:04:37Z","labels":{"name":"edge-node"}},"spec":{"taints":[{"key":"node.kubernetes.io/not-ready","effect":"NoSchedule"}]},"status":{"daemonEndpoints":{"kubeletEndpoint":{"Port":0}},"nodeInfo":{"machineID":"","systemUUID":"","bootID":"","kernelVersion":"","osImage":"","containerRuntimeVersion":"","kubeletVersion":"","kubeProxyVersion":"","operatingSystem":"","architecture":""}}}
  21. KubeEdge edge core is running, For logs visit /etc/kubeedge/kubeedge/edge/
  22. #

Note:Cloud IP refers to IP generated ,from the step 1 as highlighted

4. Edge node status on cloudCore (master node) console

On cloud host run,

  1. kubectl get nodes
  2. NAME STATUS ROLES AGE VERSION
  3. testing123 Ready <none> 6s 0.3.0-beta.0

Check if the edge node is in ready state

5.Deploy a sample pod from Cloud VM

https://github.com/kubeedge/kubeedge/blob/master/build/deployment.yaml

Copy the deployment.yaml from the above link in cloud host,run

  1. kubectl create -f deployment.yaml
  2. deployment.apps/nginx-deployment created

6.Pod status

Check the pod is up and is running state

  1. kubectl get pods
  2. NAME READY STATUS RESTARTS AGE
  3. nginx-deployment-d86dfb797-scfzz 1/1 Running 0 44s

Check the deployment is up and is running state

  1. kubectl get deployments
  2. NAME READY UP-TO-DATE AVAILABLE AGE
  3. nginx-deployment 1/1 1 1 63s

Errata

1.If GPG key for docker repo fail to fetch from key server. Please refer Docker GPG error fix

2.After kubeadm init, if you face any errors regarding swap memory and preflight checks please refer Kubernetes preflight error fix