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

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

Building from source

  • Download the source code either by

  • git clone https://github.com/kubeedge/kubeedge.git $GOPATH/src/github.com/kubeedge/kubeedge

  • cd $GOPATH/src/github.com/kubeedge/kubeedge/keadm

  • make
  • 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.  
  3. keadm init command bootstraps KubeEdge's cloud component.
  4. It checks if the pre-requisites are installed already,
  5. If not installed, this command will help in download,
  6. install and execute on the host.
  7.  
  8. Usage:
  9. keadm init [flags]
  10.  
  11. Examples:
  12.  
  13. keadm init
  14.  
  15. Flags:
  16. --docker-version string[="18.06.0"] Use this key to download and use the required Docker version (default "18.06.0")
  17. -h, --help help for init
  18. --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")
  19. --kubernetes-version string[="1.14.1"] Use this key to download and use the required Kubernetes version (default "1.14.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.
  • —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.
  • —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.  
  3. "keadm join" command bootstraps KubeEdge's edge component.
  4. It checks if the pre-requisites are installed already,
  5. If not installed, this command will help in download,
  6. to install the prerequisites.
  7. It will help the edge node to connect to the cloud.
  8.  
  9. Usage:
  10. keadm join [flags]
  11.  
  12. Examples:
  13.  
  14. keadm join --edgecontrollerip=<ip address> --edgenodeid=<unique string as edge identifier>
  15.  
  16. - For this command --edgecontrollerip flag is a Mandatory flag
  17. - This command will download and install the default version of pre-requisites and KubeEdge
  18.  
  19. keadm join --edgecontrollerip=10.20.30.40 --edgenodeid=testing123 --kubeedge-version=0.2.1 --k8sserverip=50.60.70.80:8080
  20.  
  21. - In case, any option is used in a format like as shown for "--docker-version" or "--docker-version=", without a value
  22. then default values will be used.
  23. Also options like "--docker-version", and "--kubeedge-version", version should be in
  24. format like "18.06.3" and "0.2.1".
  25.  
  26. Flags:
  27. --docker-version string[="18.06.0"] Use this key to download and use the required Docker version (default "18.06.0")
  28. -e, --edgecontrollerip string IP address of KubeEdge edgecontroller
  29. -i, --edgenodeid string KubeEdge Node unique identification string, If flag not used then the command will generate a unique id on its own
  30. -h, --help help for join
  31. -k, --k8sserverip string IP:Port address of K8S API-Server
  32. --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")
  • For KubeEdge flag the functionality is same as mentioned in keadm init
  • -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.  
  3. keadm reset command can be executed in both cloud and edge node
  4. In master node it shuts down the cloud processes of KubeEdge
  5. In worker node it shuts down the edge processes of KubeEdge
  6.  
  7. Usage:
  8. keadm reset [flags]
  9.  
  10. Examples:
  11.  
  12. For master node:
  13. keadm reset
  14.  
  15. For worker node:
  16. keadm reset --k8sserverip 10.20.30.40:8080
  17.  
  18. Flags:
  19. -h, --help help for reset
  20. -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 edgeController (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, obeserve 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 --edgecontrollerip=<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 --edgecontrollerip=<cloudIP> --edgenodeid=<unique string as edge identifier> --k8sserverip=<cloudIP>:8080 --kubeedge-version=<kubeedge Version> --docker-version=<Docker version>

Sample execution output:

  1. # ./keadm join --edgecontrollerip=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/edge_core
  12. kubeedge/cloud/
  13. kubeedge/cloud/edgecontroller
  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.  
  20. KubeEdge Edge Node: testing123 successfully add to kube-apiserver, with operation status: 201 Created
  21. 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":""}}}
  22.  
  23. KubeEdge edge core is running, For logs visit /etc/kubeedge/kubeedge/edge/
  24. #

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

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

On cloud host run,

  1. kubectl get nodes
  2.  
  3. NAME STATUS ROLES AGE VERSION
  4. 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.  
  3. NAME READY UP-TO-DATE AVAILABLE AGE
  4. 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