This tutorial is about installing KubeEdge on top of the already successful Installation of Kubernetes.
Installation instructions
- Kubeedge v1.0.0
Install the cloud side
Example Modify the configuration of the K8S master node
Cloud side is a component of KubeEdge that interacts with Kube-Apiserver. In this tutorial, the non-secure port used by Cloud side to interact with Kube-Apiserver needs to be modified on k8S master node as follows:
vi /etc/kubernetes/manifests/kube-apiserver.yaml
# Add the following flags in spec: containers: -command section
- --insecure-port=8080
- --insecure-bind-address=0.0.0.0
Copy the code
Downloading the Installation package
You can download the installation packages in either curl or kubeedge’s release repository
Download from curl
ARCH=" AMd64 "curl -l "https://github.com/kubeedge/kubeedge/releases/download/${VERSION}/kubeedge-${VERSION}-${OS}-${ARCH}.tar.gz" --output kubeedge-${VERSION}-${OS}-${ARCH}.tar.gz && tar -xf kubeedge-${VERSION}-${OS}-${ARCH}.tar.gz -C /etcCopy the code
Curl curl curl curl curl curl curl curl curl curl curl curl
Download it from kubeedge’s release repository
Kubeedge v1.0.0 release: kubeedge-v1.0.0-linux-amd64.tar.gz: kubeedge-v1.0.0-linux-amd64.tar. Perform the following operations:
#tar -zxvf kubeeds-v1.0.0-linux-amd64.tar. gz # mv kubeeds-v1.0.0-linux-amd64 /etc/kubeedgeCopy the code
Generate a certificate on the K8S master node
The generated certificate is used for encrypted communication between the Edge end of KubeEdge and the Cloud end. The certificate generation steps are as follows:
wget -L https://raw.githubusercontent.com/kubeedge/kubeedge/master/build/tools/certgen.sh # make script executable chmod +x certgen.sh bash -x ./certgen.sh genCertAndKey edgeCopy the code
After the above steps are successful, the ca and certs directories are generated under /etc/kubeedge.
In the/etc/kubeedge/cloud/conf/controller. The yaml for newly generated certificate path to modify the part as follows:
cloudhub.ca
cloudhub.cert
cloudhub.key
Copy the code
Note: by default, the above three paths do not need to be modified.
Create device Model and Device CRDs
Create device Model and Device CRDs required by KubeEdge on k8S master node as follows:
wget -L https://raw.githubusercontent.com/kubeedge/kubeedge/master/build/crds/devices/devices_v1alpha1_devicemodel.yaml
# make script executable
chmod +x devices_v1alpha1_devicemodel.yaml
kubectl create -f devices_v1alpha1_devicemodel.yaml
wget -L https://raw.githubusercontent.com/kubeedge/kubeedge/master/build/crds/devices/devices_v1alpha1_device.yaml
# make script executable
chmod +x devices_v1alpha1_device.yaml
kubectl create -f devices_v1alpha1_device.yaml
Copy the code
Run the cloud side
Run cloud side of KubeEdge on K8S master node.
cd /etc/kubeedge/cloud
# run edge controller
# `conf/` should be in the same directory where cloudcore resides
# verify the configurations before running cloud(cloudcore)
./cloudcore
Copy the code
Note: In addition to the above methods, you can also run through Systemd.
Install the edge side
Edge is the part of KubeEdge that runs on edge devices. Before edge can run, you need to install the appropriate container runtime: Docker, Containerd, and Cri-O.
The Edge installation package is ready
K8s master kubeedge = /etc/kubeedge = /etc/ edge
SCP -r /etc/kubeedge root@[edge node IP address]:/etcCopy the code
Create edge node on k8S master node
# vi node.json
{
"kind": "Node",
"apiVersion": "v1",
"metadata": {
"name": "edge-node",
"labels": {
"name": "edge-node",
"node-role.kubernetes.io/edge": ""
}
}
}
# kubectl create -f node.json
Copy the code
Modify edge configuration
Modified two parts :(1) the IP address of the edge terminal connecting to the cloud terminal. (2) the name of the edge terminal corresponds to the node created on k8s master.
# edgeHub.websocket. url: IP changed to k8s master IP port unchanged edgehub.quic.url: Controller :node-id: k8s controller:node-id: k8s controller:node-id: K8s controller:node-id: K8s controller: k8s master Set this parameter to the name of the node created on the K8S master. Edged :hostname-override: Specifies the name of the node created on the K8S masterCopy the code
Run the edge side
run edgecore
cd /etc/kubeedge/edge
./edgecore
Copy the code
Note: In addition to the above methods, you can also run through Systemd.