1. Docker+EdgeX
1.1 安装docker
换源,参考以下网址
https://blog.csdn.net/MangoHHHH/article/details/110563964
下载安装docker
sudo curl -fsSL https://get.daocloud.io/docker | sh
验证是否安装成功
sudo docker run hello-world
1.2 安装docker-compose
sudo pip3 install docker-compose
如果报错找不到ffi.h文件,参考以下网址
https://blog.csdn.net/boling_cavalry/article/details/101105693
如果在安装过程中卡住不动就使用如下命令
sudo pip3 -v install docker-compose
验证是否安装成功
docker-compose version
1.3 安装EdgeX
获取edgex-compose所有的文件
sudo git clone https://github.com/edgexfoundry/edgex-compose.git
使用带ui的EdgeX的yml文件,并重命名为docker-compose.yml
注意自己操作系统选择对应架构的yml文件
sudo cp edgex-compose/docker-compose-no-secty-with-ui-arm64.yml docker-compose.yml
docker启动EdgeX参考如下网址
https://blog.csdn.net/qq_43796312/article/details/121330293
2. k3s+Edgex
2.1 raspberry
2.1.1 Raspbian Buster 启用旧版的 iptables
Raspbian Buster 默认使用nftables
而不是iptables
。 k3s 网络功能需要使用iptables
,而不能使用nftables
。 按照以下步骤切换配置Buster
使用legacy iptables
:
sudo iptables -F
sudo update-alternatives --set iptables /usr/sbin/iptables-legacy
sudo update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy
2.1.2 Raspbian Buster 启用 cgroup
标准的 Raspbian Buster 安装没有启用 cgroups
。k3s
需要cgroups
来启动 systemd
服务。在/boot/cmdline.txt
中第一行末尾直接添加cgroup_memory=1 cgroup_enable=memory
(不要换行)就可以启用cgroups
。重启系统以生效。
reboot
2.1.3 server节点
设置K3S_URL
参数会使 k3s
以worker
模式运行。k3s agent
将在所提供的URL
上向监听的 k3s
服务器注册。K3S_TOKEN
使用的值存储在你的服务器节点上的/var/lib/rancher/k3s/server/node-token
路径下。
curl -sfL http://rancher-mirror.cnrancher.com/k3s/k3s-install.sh | INSTALL_K3S_MIRROR=cn K3S_NODE_NAME=master sh -
其中K3S_NODE_NAME
是节点名称,可按需更改。
2.1.4 获取token
K3S_TOKEN
使用的值存储在服务器节点上的/var/lib/rancher/k3s/server/node-token
路径下。
2.1.5 agent节点
curl -sfL http://rancher-mirror.cnrancher.com/k3s/k3s-install.sh | INSTALL_K3S_MIRROR=cn K3S_URL=https://master:6443 K3S_TOKEN=K10a9880b0d8360928547521975137be62ba6dbf32ea4ab3e1764c06a930eec0d84::server:57b40274552955b9e01d8d7e00f4e666 K3S_NODE_NAME=agent01 sh -
其中K3S_URL
中的master
是server节点地址,自行更换;K3S_TOKEN
的值获取参考2.1.4操作。
2.1.6 禁止调度server
可选,在server节点上执行如下命令,部署EdgeX时不会在server节点上运行pod
kubectl cordon server
2.1.7 获取k3s部署EdgeX的yaml文件
参考如下网址:
https://mp.csdn.net/mp_blog/creation/editor/121344430
2.1.8 使用yaml文件部署EdgeX
kubectl apply -f k3s-redis-no-secty-with-ui-arm64.yaml
查看node信息
kubectl get node
查看node详细信息
kubectl get node -o wide
查看pod信息
kubectl get pod
查看pod详细信息
kubectl get pod -o wide
2.2 ubuntu
参考树莓派部署的2.1.3-2.1.8,注意使用的yaml文件需要对应amd64架构。