华为云搭建Kubeedge
【摘要】 华为云搭建Kubeedge创建一个CCE集群,并创建一个节点,云端节点cloud–>4V8G创建一个ECS主机,边缘节点edge–>4V8G 部署云端云端cloud节点已安装kubernetes,边缘节点不需要[root@cloud ~]# kubectl get pod -ANAMESPACE NAME RE...
华为云搭建Kubeedge
创建一个CCE集群,并创建一个节点,云端节点cloud–>4V8G
创建一个ECS主机,边缘节点edge–>4V8G
部署云端
云端cloud节点已安装kubernetes,边缘节点不需要
[root@cloud ~]# kubectl get pod -A
NAMESPACE NAME READY STATUS RESTARTS AGE
kube-system coredns-55f45f58cc-4nzql 0/1 Pending 0 11m # 华为云插件起的是两个pod,两个pod间有工作负载反亲和
kube-system coredns-55f45f58cc-89h26 1/1 Running 0 11m
kube-system everest-csi-controller-99fd58b49-k8qf8 0/1 Pending 0 11m
kube-system everest-csi-controller-99fd58b49-m94q9 1/1 Running 0 11m
kube-system everest-csi-driver-pbnvr 1/1 Running 0 5m15s
kube-system icagent-mfxln 1/1 Running 0 5m15s
安装keadm工具,镜像通过github下载
# 解压安装包
[root@cloud ~]# tar -zxvf keadm-v1.11.1-linux-amd64.tar.gz
keadm-v1.11.1-linux-amd64/
keadm-v1.11.1-linux-amd64/keadm/
keadm-v1.11.1-linux-amd64/keadm/keadm
keadm-v1.11.1-linux-amd64/version
# 添加执行权限
[root@cloud ~]# mv keadm-v1.11.1-linux-amd64/keadm/keadm /usr/local/bin/
[root@cloud ~]# chmod +x /usr/local/bin/keadm
# 查看安装版本
[root@cloud ~]# keadm version
version: version.Info{Major:"1", Minor:"11", GitVersion:"v1.11.1", GitCommit:"6ccb68fae799d210d9f304df9cba210c492432a7", GitTreeState:"clean", BuildDate:"2022-07-11T15:23:12Z", GoVersion:"go1.17", Compiler:"gc", Platform:"linux/amd64"}
安装cloudcore
# --adverties-address-->填写公网
# --profile-->对应刚刚安装的版本号
[[root@cloud ~]# keadm init --advertise-address=124.70.211.167 --profile version=v1.11.1
Kubernetes version verification passed, KubeEdge installation will start...
CLOUDCORE started
=========CHART DETAILS=======
NAME: cloudcore
LAST DEPLOYED: Sun Apr 23 19:19:16 2023
NAMESPACE: kubeedge
STATUS: deployed
REVISION: 1
# 以容器的方式部署,查看kubeedge下的pod
[root@cloud ~]# kubectl get pod -n kubeedge
NAME READY STATUS RESTARTS AGE
cloudcore-74bf7dfdbc-rlzzx 1/1 Running 0 56s
# 端口正常开放
[root@cloud ~]# netstat -ntlp
tcp6 0 0 :::10000 :::* LISTEN 15003/cloudcore
tcp6 0 0 :::10002 :::* LISTEN 15003/cloudcore
tcp6 0 0 :::10003 :::* LISTEN 15003/cloudcore
tcp6 0 0 :::10004 :::* LISTEN 15003/cloudcore
部署边缘端
安装keadm
[root@edge ~]# tar -zxvf keadm-v1.11.1-linux-amd64.tar.gz
keadm-v1.11.1-linux-amd64/
keadm-v1.11.1-linux-amd64/keadm/
keadm-v1.11.1-linux-amd64/keadm/keadm
keadm-v1.11.1-linux-amd64/version
[root@edge ~]# mv keadm-v1.11.1-linux-amd64/keadm/keadm /usr/local/bin/
[root@edge ~]# chmod +x /usr/local/bin/keadm
[root@edge ~]# keadm version
version: version.Info{Major:"1", Minor:"11", GitVersion:"v1.11.1", GitCommit:"6ccb68fae799d210d9f304df9cba210c492432a7", GitTreeState:"clean", BuildDate:"2022-07-11T15:23:12Z", GoVersion:"go1.17", Compiler:"gc", Platform:"linux/amd64"}
安装docker
# 添加docker阿里源
[root@edge ~]# wget https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo -O /etc/yum.repos.d/docker-ce.repo
# 进入文件将 docker-ce-test 中 enabled=0 改为 enabled=1
[root@edge ~]# vim /etc/yum.repos.d/docker-ce.repo
[docker-ce-test]
name=Docker CE Test - $basearch
baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/$releasever/$basearch/test
enabled=1
# 安装docker
[root@edge ~]# yum install docker-ce -y
# 启动docker
[root@edge ~]# systemctl start docker
# 查看状态
[root@edge ~]# systemctl status docker
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
Active: active (running) since Sun 2023-04-23 14:16:16 CST; 23s ago
# 设置edge mesh
[root@edge ~]# vim /etc/nsswitch.conf
修改为 hosts: dns files mdns4_minimal [NOTFOUND=return]
# 设置ip forward
[root@edge ~]# echo "net.ipv4.ip_forward = 1" >> /etc/sysctl.conf
[root@edge ~]# sysctl -p | grep ip_forward
net.ipv4.ip_forward = 1
部署边缘端edgecore
# 为了准确加入云端,先获取云端token
[root@cloud ~]# keadm gettoken
864325bfb95a3ec4f866dd60ec0fbbb70c0664c5efa92e6d46e8f783418b0630.eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2ODIzMTYxNTR9.jKu1hzzearoxWbeKSyTUqt-VWGKsI__o35e3vOoFOtE
# --edgenode-name(可选)设置主机名,不写则为默认主机名
[root@edge ~]# keadm join --token=<云端token值> --cloudcore-ipport=<云端ip>:10000 --kubeedge-version=1.11.1
I0423 21:02:42.700708 8593 command.go:845] 1. Check KubeEdge edgecore process status
I0423 21:02:42.707534 8593 command.go:845] 2. Check if the management directory is clean
I0423 21:02:42.707581 8593 join.go:100] 3. Create the necessary directories
I0423 21:02:42.708164 8593 join.go:176] 4. Pull Images
Pulling kubeedge/installation-package:v1.11.1 ...
Successfully pulled kubeedge/installation-package:v1.11.1
Pulling eclipse-mosquitto:1.6.15 ...
Successfully pulled eclipse-mosquitto:1.6.15
Pulling kubeedge/pause:3.1 ...
Successfully pulled kubeedge/pause:3.1
查看状态
[root@edge ~]# systemctl status edgecore
● edgecore.service
Loaded: loaded (/etc/systemd/system/edgecore.service; enabled; vendor preset: disabled)
Active: active (running) since Sun 2023-04-23 21:05:44 CST; 30s ago
Main PID: 8820 (edgecore)
Tasks: 12
Memory: 37.2M
CGroup: /system.slice/edgecore.service
└─8820 /usr/local/bin/edgecore
云端查看集群状态
[root@cloud ~]# kubectl get nodes
NAME STATUS ROLES AGE VERSION
172.16.1.236 Ready <none> 14m v1.25.1-r0-CCE22.11.1
edge Ready agent,edge 37s v1.22.6-kubeedge-v1.11.1
【版权声明】本文为华为云社区用户原创内容,未经允许不得转载,如需转载请自行联系原作者进行授权。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
cloudbbs@huaweicloud.com
- 点赞
- 收藏
- 关注作者
评论(0)