安装 EdgeWize
本节介绍如何安装边缘计算扩展组件 - EdgeWize。
步骤 1:纳管集群 kubeconfig 并导入根证书
为了给 EdgeWize 网关和边缘集群 CloudCore 颁发服务器证书,EdgeWize 需要获取根证书和对应的私钥。
警告 |
---|
|
-
解压 EdgeWize 安装包中的 ewctl 命令行工具到指定目录。
tar -zxvf <ewctl package name> -C /usr/local/bin/
-
(可选)若想避免在使用 ewctl 时对集群默认的 kubeconfig 文件进行修改,可创建 EdgeWize 专用的 kubeconfig 文件。如,在任意路径下创建空的 kubeconfig 文件。
touch /root/edgewize-config
-
(可选)为方便后续操作,可以设置 KUBECONFIG 环境变量。假设当前 ewctl 使用的 kubeconfig 文件路径为 /root/edgewize-config:
export KUBECONFIG="/root/edgewize-config"
-
将底层 meta 集群的 kubeconfig 配置(默认位置假设为 /root/.kube/config)导入 ewctl 使用的 kubeconfig 文件。
ewctl config metacluster -f /root/.kube/config
-
将 KubeSphere 企业版 host 集群的 kubeconfig 配置(默认位置假设为 /root/.kube/config)导入 ewctl 使用的 kubeconfig 文件。
ewctl config hostcluster -f /root/.kube/config
说明 在 KubeSphere 企业版中,meta 集群和 host 集群实际为同一个集群。
-
生成 EdgeWize 签发证书所需的根证书和私钥。执行命令之后会在本地 /root/certs 文件夹下生成 rootCA.crt 和 rootCA.key 两个文件。
mkdir /root/certs ewctl certs create --caCrtFilePath /root/certs --caKeyFilePath /root/certs
-
将本地的根证书和私钥导入 host 集群。
ewctl certs import --caCrtFilePath /root/certs/rootCA.crt --caKeyFilePath /root/certs/rootCA.key -c
步骤 2:安装 EdgeWize
-
登录 KubeSphere 企业版 Web 控制台,在扩展中心安装 EdgeWize 扩展组件。
点击开始安装前,需修改扩展组件配置。
edgewize-ota-server: mqtt: host: "172.31.19.30" # 替换为 host 集群节点的 IP 地址 port: 31883 username: "admin" password: "P@88w0rd"
edgewize: advertiseAddress: - "172.31.19.30" # 替换为 host 集群节点的 IP 地址 dnsNames: - edgewize.io
vclusterK8s: syncer: image: edgewize/vcluster:v0.13.1 extraArgs: - --tls-san=172.31.19.30,*.edgewize.io # 根据 edgewize.advertiseAddress 同步修改 IP 地址
tls-san
中设置的 IP 和域名,用于为虚拟集群(vcluster)部署的 Kubernetes 生成证书。 -
点击开始安装,安装 EdgeWize 扩展组件。
步骤 3:修改配置字典
若 KubeSphere 企业版使用了私有镜像仓库,为了使边缘集群的 ks-core 也使用私有镜像仓库,需要修改 host 集群的 extension-edgewize
项目下的 configmap custom-kubesphere-config
.
-
登录 KubeSphere 企业版 Web 控制台,进入 host 集群。
-
点击配置 > 配置字典,搜索
custom-kubesphere-config
。 -
点击配置字典名称,进入详情页面。
-
点击操作 > 编辑设置, 编辑已有的键值对数据,添加 global 配置如下,然后点击确定。
global: imagePullSecrets: [] imageRegistry: dockerhub.kubekey.local/kse # 替换为实际的镜像仓库地址
-
重启 host 集群的
edgewize-controller-manager
工作负载。kubectl rollout restart deployment edgewize-controller-manager -n extension-edgewize