Online deployment kubeedge 1.6 detailed tutorial (Ubuntu)

Online deployment kubeedge 1.6 detailed tutorial (Ubuntu)

Basic environment:

OS: centos7; Ubuntu;
docker: 20.10.7

Role system IP
master centos7(amd64) 172.16.0.114
edge free (arm64) 172.16.0.113

Notes on kubeedge deployment

  1. master to successfully deploy kubernetes, and the master node is in the ready state.
  2. Edge does not execute the kubeadm join command

kubeedge deployment configuration

1. master:

1. Refer to this article to complete the following operations on the master node:

kubernetes deployment
(1) close the firewall
(2) close selinux
(3) close the swap partition
(4) change the host name
(5) add hosts in the master:

nano /etc/hosts   #在该文件中添加以下信息.

172.16.0.114 master
172.16.0.113 edge

(6) Time synchronization
(7) Install docker/kubeadm/kubelet/kubectl
(8) Execute the kubeadm init operation to complete the deployment of kubernetes and ensure that the master is in the ready state

2. Deploy golang and gcc

(1) Download golang

#可自行前往官网下载
wget https://golang.google.cn/dl/go1.15.3.linux-amd64.tar.gz
#解压压缩包
tar -zxvf go1.15.3.linux-amd64.tar.gz -C /usr/local
#配置golang环境
vim /etc/profile
#添加以下内容
export GOROOT=/usr/local/go
export GOPATH=/data/gopath
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
#使配置生效
source /etc/profile
go version  #查看golang版本

(2) Deploy gcc

yum -y install gcc
gcc -v  #查看gcc版本

3. Use keadm to deploy kubeedge

(1) Download keadm

#可自行前往官网下载
wget https://github.com/kubeedge/kubeedge/releases/download/v1.4.0/keadm-v1.4.0-linux-amd64.tar.gz
#解压压缩包
tar -zxvf keadm-v1.4.0-linux-amd64.tar.gz
#master部署kubeedge
cd keadm-v1.4.0-linux-amd64/keadm
#在keadm目录下,执行init操作(ip为master结点ip):
./keadm init --advertise-address="172.16.0.114" --kubeedge-version=1.6.0
#【注】在这里会出现错误,原因为raw.githubusercontent.com无法访问
#解决方案:在/etc/hosts文件中,加入以下内容:
# GitHub Start
185.199.109.133 raw.githubusercontent.com
185.199.108.133 raw.githubusercontent.com
185.199.111.133 raw.githubusercontent.com
185.199.110.133 raw.githubusercontent.com
# GitHub End
#再次执行init即可

[Note] If kubeedge fails to download successfully due to connected failure, you can click here to download kubeedge and put it in the /etc/kubeedge directory and decompress it, then execute the init command again

If the following content appears, the deployment is successful.
insert image description here
Execute ./keadm gettoken in the keadm-v1.4.0-linux-amd64/keadm directory to obtain the token

Two, edge1:

  1. turn off firewall
ufw disable   #关闭并永久关闭
  1. Close the swap partition
sudo swapoff -a     #临时关闭
sudo vi /etc/fstab  #永久关闭,注释掉带有swap的一行
  1. install docker
sudo curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
systemctl start docker&&systemctl enable docker
  1. Deploy golang and gcc
sudo apt install golang-go
sudo apt-get install gcc
sudo go version &&gcc -v   #查看版本
  1. Modify /etc/hosts
nano /etc/hosts   #在该文件中添加以下信息.

172.16.0.114 master
172.16.0.113 edge
  1. update time zone
#校准时间
sudo tzselect
#首先选择亚洲Asia,继续选择中国China,最后选择北京Beijing。.
sudo ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
#可以使用date查看时间
  1. Use keadm to deploy kebeedge on the edge node
#下载keadm
wget https://github.com/kubeedge/kubeedge/releases/download/v1.4.0/keadm-v1.4.0-linux-arm64.tar.gz
#解压压缩包
tar -zxvf keadm-v1.4.0-linux-arm64.tar.gz
#master部署kubeedge
cd keadm-v1.4.0-linux-arm64/keadm
#在keadm目录下,执行join操作(注意修改ip与edgenode-name,并在token后添加在master中获取到的token):
./keadm join --cloudcore-ipport=172.16.0.114:10000 --edgenode-name=test --kubeedge-version=1.6.0 --token=

#【注】在这里会出现错误,原因为raw.githubusercontent.com无法访问
#解决方案:在/etc/hosts文件中,加入以下内容:
# GitHub Start
185.199.109.133 raw.githubusercontent.com
185.199.108.133 raw.githubusercontent.com
185.199.111.133 raw.githubusercontent.com
185.199.110.133 raw.githubusercontent.com
# GitHub End
#再次执行init即可

[Note] If kubeedge fails to download successfully due to connected failure, you can click here to download kubeedge and put it in the /etc/kubeedge directory and decompress it, then execute the init command again

If the following content appears, the deployment is successful
insert image description here

3. Kubeedge deployment hidden problems

After cloudcore and edgecore are successfully deployed, executing kubectl get nodes in the master may not display the edge node. Solution
:
Modify the /etc/kubeedge/edgecore.service file on the edge node and change
the directory of edgecore to /usr/local Change /bin/edgecore to /etc/kubeedge/edgecore
After the modification is complete and restart the edgecore.service service, you can view the edge node and the master node in the master

Guess you like

Origin blog.csdn.net/xiaoxuanxuan12/article/details/118766710