As the first open source edge cloud native project of Alibaba, OpenYurt involves two fields of edge computing and cloud native. However, many edge computing developers are not familiar with cloud native knowledge. In order to lower the threshold of OpenYurt and help more developers to quickly learn OpenYurt, the community provides the OpenYurt ease-of-use tool YurTCtl. This tool aims to eliminate the complexity of OpenYurt cluster creation and help developers quickly build OpenYurt development test clusters locally.

OpenYurt uses the cloud tube edge architecture, on the basis of the original Kubernetes cluster, in the form of Addon function enhancement, to solve the cloud tube edge scene, cloud edge network instability, cloud edge operation and maintenance and other key problems. And realized the workload/flow unit management, edge local storage, Internet of Things device management and other core functions. The topology of the experiment in this paper is shown as follows:

The blue part is the native K8S component, and the orange part is the component provided by OpenYurt.

  • The Master Node is located in the Cloud as the control Node of the OpenYurt cluster and the Cloud Node of the cluster. The controlPlane component of the original K8S is deployed on the Master Node. And the control components of OpenYurt: Yurt-Controller-Manager, Yurt-app-Manager, and Yurt-Tunnel-Server
  • As a Cloud Node of the OpenYurt cluster, a Cloud-Node is located in the Cloud and can be used to deploy control components of OpenYurt. In this paper, only the access operation of the Cloud Node is demonstrated, and no control components of OpenYurt are actually deployed.
  • Edge-node is located at the Edge of the cluster. As the Edge Node of the cluster, the edge-node is deployed with YurtHub, an autonomous Node component, and tunnel-Agent, a cloud channel component.

Environment to prepare

(1) Three computers with Linux operating system. One as control plane node (also cloud node), one as cloud node, and one as edge node, all Ubuntu18.04).

(2) Docker is pre-installed. Please refer to the installation method.

(3) Shut down the system switch partition. The closing methods of different versions of the system are different. In this paper, swAPOFF -A is executed to shut down the system switch partition.

(4) Download OpenYurt community code, build YurTCTL tool, and copy YurTCTL to three hosts.

git clone https://github.com/openyurtio/openyurt.git
cd openyurt
export GOOS=linux GOARCH=amd64; make build  WHAT=cmd/yurtctl
Copy the code

The constructed Yurtctl is in the directory _output/bin/, where the version of Yurtctl used in this paper is:

root@master:~# ./yurtctl --version yurtctl version: Projectinfo. Info {GitVersion: "v0.4.1 GitCommit:" CCC "3315, BuildDate:" the 2021-09-08 T02: at Z, "GoVersion:" go1.13." Compiler:"gc", Platform:"linux/amd64"}Copy the code

Pull up the control surface node by one key

In YurTCtl, init subcommand is provided to pull up the OpenYurt management node. The management and control component of Kubernetes cluster (KuBE-Apiserver/KuBE-Scheduler/kuBE-Controller – Manager/ETCD) is deployed in this node. In addition, the controller is deployed as the OpenYurt cloud controller node (Yurt-Controller-Manager, Yurt-app-Manager, and Yurt-Tunnel-Server).

On the control plane node, run the following command

root@master:~# ./yurtctl init --image-repository=registry.cn-hangzhou.aliyuncs.com/google_containers - kubernetes - version = v1.18.8 - pod - network - cidr = 10.244.0.0/16Copy the code

This command specifies the Kubernetes related components of mirror for registry.cn-hangzhou.aliyuncs.com/google_containers warehouse, in addition the specified version of Kubernetes clusters for 1.18.8 (recommended). For more arguments to the yurtctl init directive, see yurtctl init –help.

After the yurtctl init command is executed successfully, the command for adding cloud nodes and edge nodes is output synchronously.

Your OpenYurt cluster control-plane has initialized successfully! To start using your cluster, you need to run the following as a regular user: mkdir -p $HOME/.kube sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config sudo chown $(id -u):$(id -g) $HOME/.kube/config Then you can join any number of edge-nodes by running the following on each as root: Lvmb7orduikbyjqu \ -- Discovery - tok-ca-cert-hash sha256:0e1faf696fe976a7b28c03e0dece429c85d72e6e1e6bc2dd1ac3d30d0416f3f0 --node-type=edge-node And you can join any number of cloud-nodes by running the following on each as root: Lvmb7orduikbyjqu \ -- Discovery - tok-ca-cert-hash sha256:0e1faf696fe976a7b28c03e0dece429c85d72e6e1e6bc2dd1ac3d30d0416f3f0 --node-type=cloud-nodeCopy the code

Execute the following command as prompted to copy the certificate to the corresponding directory to use Kubectl to operate the cluster

mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
Copy the code

Check the status of the master node

root@master:~# kubectl get nodes NAME STATUS ROLES AGE VERSION master Ready < None > 50s V1.18.8Copy the code

Check whether the master component is Running

root@master:~# kubectl get pods -A NAMESPACE NAME READY STATUS RESTARTS AGE kube-system controlplane-master 4/4 Running 0 55s kube-system coredns-546565776c-88hs6 1/1 Running 0 46s kube-system coredns-546565776c-v5wxb 1/1 Running 0 46s kube-system kube-flannel-ds-h6qqc 1/1 Running 0 45s kube-system kube-proxy-6rnq2 1/1 Running 0 45s kube-system yurt-app-manager-75b7f76546-6dsw9 1/1 Running 0 45s kube-system yurt-app-manager-75b7f76546-x6wzm 1/1 Running 0 45s kube-system yurt-controller-manager-697877d548-kd5xf 1/1 Running 0 46s kube-system yurt-tunnel-server-bc5cb5bf-xxqgj 1/1  Running 0 46sCopy the code

The functions of each component are as follows:

  • controlplaneIs the all-in-one Kubernetes management and control component. In order to understand the relationship between OpenYurt and Kubernetes,yurtctl initDeploy the Kubernetes management and control components in the same Pod as a black box.
  • yurt-app-managerProvide workload unit deployment, operation and maintenance capabilities for OpenYurt unit components;
  • yurt-controller-managerFor node lifecycle management components, with edge nodes onyurt-hubCooperate to realize the autonomous function of edge nodes;
  • yurt-tunnel-serverFor the server end of the cloud side operation and maintenance channel, and on the edge nodeyurt-tunnel-agentCooperate to realize the operation and maintenance capability from cloud to edge.

One-click access to cloud nodes

The cloud node is used to deploy OpenYurt related system components. In YurTCtl, the join subcommand is provided to add cloud nodes to the OpenYurt cluster. In addition, when initializing the master node with yurTCtl init, the master node is also used as a cloud node. If a new cloud node needs to be added, you can use the output of init to copy the cloud node access command to the cloud node to be added.

root@cloud-node:~#./yurtctl join 111.32.157.130:6443 -- Token vowclg. K7059m0f0qbcebpg --discovery-token-ca-cert-hash sha256:30846295ea024260bc3c4988507c4408e8756ca5440221e109fe8167f636f125 --node-type=cloud-nodeCopy the code

The access command specifies the address of the master node, the token required for access authentication, and the type of the node to be added (Cloud-node). The following output is displayed after the command is executed successfully

This node has joined the cluster:
* Certificate signing request was sent to apiserver and a response was received.
* The Kubelet was informed of the new secure connection details.

Run 'kubectl get nodes' on the control-plane to see this node join the cluster.
Copy the code

Check whether the cloud node is Ready on the master node

root@master:~# kubectl get nodes -l openyurt.io/is-edge-worker=false NAME STATUS ROLES AGE VERSION cloud-node Ready < None > 5m4s v1.18.8 Master Ready < None > 9m40s v1.18.8Copy the code

One-click access to edge nodes

As the actual service deployment node in the OpenYurt cluster, the edge node is usually deployed on the user’s Intranet, and the network connection between the edge node and the control component is unstable. Therefore, yurt-Hub and Yurt-Tunnel-Agent must be deployed on edge nodes. In YurTCtl, the join subcommand is provided to add edge nodes to an OpenYurt cluster. Use the output command in init to copy the edge node access instructions to the edge node that you want to add.

root@edge-node:~#./yurtctl join 111.32.157.130:6443 -- Token vowclg. K7059m0f0qbcebpg --discovery-token-ca-cert-hash sha256:30846295ea024260bc3c4988507c4408e8756ca5440221e109fe8167f636f125 --node-type=edge-nodeCopy the code

The access command specifies the IP address of the master node, the token required for access authentication, and the type of the edge-node to be added. The following output is displayed after the command is executed successfully

This node has joined the cluster:
* Certificate signing request was sent to apiserver and a response was received.
* The Kubelet was informed of the new secure connection details.

Run 'kubectl get nodes' on the control-plane to see this node join the cluster.
Copy the code

Check whether the edge node is Ready on the master node

root@master:~# kubectl get nodes -l openyurt.io/is-edge-worker=true NAME STATUS ROLES AGE VERSION edge-node Ready <none> 26 s v1.18.8Copy the code

Check whether the components of the edge node are Running

root@master:~# kubectl get pods -A -o wide | grep edge-node
kube-system   kube-flannel-ds-tdqtx                      1/1     Running   0          58s   103.15.99.183    edge-node    <none>           <none>
kube-system   kube-proxy-8r76s                           1/1     Running   0          58s   103.15.99.183    edge-node    <none>           <none>
kube-system   yurt-hub-edge-node                         1/1     Running   0          16s   103.15.99.183    edge-node    <none>           <none>
kube-system   yurt-tunnel-agent-v4jwt                    1/1     Running   0          38s   103.15.99.183    edge-node    <none>           <none>
Copy the code

The functions of each component on each edge node are as follows:

  • yurt-hubAutonomous components of edge nodes. Components on edge nodes pass throughyurt-hubwithkube-apiserverInteraction. When the cloud-side network is good,yurt-hubForward requests to node componentskube-apiserverAnd the Response content is cached. When the cloud goes offline,edge-hubRetrieves data from the local cache in response to a request from an edge node component.
  • yurt-tunnel-agentCloud side OPERATION and maintenance channel client, withyurt-tunnel-serverCooperate to realize the operation and maintenance from cloud to edge.

After the above four steps, you can have an OpenYurt cluster locally. If you need to clean the OpenYurt cluster, you can do it on each node in the cluster./yurtctl reset.

OpenYurt is backed by native Kubernetes and is geared towards edge computing scenarios. Due to the complexity of Kubernetes itself, it is difficult for many students in non-native fields to use it. The OpenYurt cluster is the first step to getting started, blocking most edge computing players. In order to improve the ease of use of OpenYurt, YurTCTL designs tools such as init, Join, reset and convert to help users quickly build OpenYurt clusters locally, leap-over the first step of using OpenYurt. Although ease of use has been greatly improved, there are still many shortcomings. We look forward to the active participation of students in the community to build a more easy-to-use edge cloud native infrastructure based on OpenYurt.

Communication and exchange

If you have any questions about OpenYurt, please scan the QR code or search group number (31993519) to join the Group.

Related links: github.com/openyurtio/… Docs.docker.com/engine/inst…