Enable Kubectl logs/exec to debug pods on the edge

Prepare certs

确保可以找到 Kubernetes 的 ca.crt 和 ca.key 文件。如果您通过 kubeadm 设置您的 Kubernetes 集群,这些文件将位于 /etc/kubernetes/pki/ 目录中。

ls /etc/kubernetes/pki/

设置 CLOUDCOREIPS 环境变量。该环境变量用于指定 cloudcore 的 IP 地址,或者是一个高可用集群的 VIP(虚拟IP)。

export CLOUDCOREIPS="192.168.133.152"

(警告:必须使用相同的终端才能继续工作,否则必须再次键入此命令。使用以下命令检查环境变量:

echo $CLOUDCOREIPS

在云节点上为 CloudStream 生成证书,但是,生成文档不在 /etc/kubeedge/ 中,我们需要从从 GitHub 克隆的 git 存储库中复制它。将用户更改为 root:

sudo su

从原始克隆库中复制证书生成文件:

wget https://github.com/kubeedge/kubeedge/blob/v1.10.0/build/tools/certgen.sh #下载对应版

chmod +x certgen.sh

从certgen.sh生成证书

Set Iptables Rule

在主机上设置iptables。此命令应在部署apiserver的每个节点上执行(在这种情况下,它是主节点,并且以root身份执行该命令)。

在每个运行apiserver的主机上运行以下命令:

注意:您需要首先设置cloudcoreips变量

iptables -t nat -A OUTPUT -p tcp --dport 10350 -j DNAT --to $CLOUDCOREIPS:10003

Port 10003 and 10350 are the default ports for the CloudStream and edgecore, use your own ports if you have changed them.

如果您不确定是否设置了iptables,并且想要清除所有设置。(如果您错误地设置了iptables,它将阻止您使用此功能)以下命令可用于清理iptables:

iptables -F && iptables -t nat -F && iptables -t mangle -F && iptables -X

Update Configurations

在cloudcore和edgecore上修改/etc/kubeedge/config/cloudcore.yaml和/etc/kubeedge/config/edgecore.yaml。设置cloudStream和edgeStream以启用:true。将服务器IP更改为cloudcore的IP(与$CLOUDCOREIPS相同)。

修改 /etc/kubeedge/config/cloudcore.yaml:

修改 /etc/kubeedge/config/edgecore.yaml:

Restart

  1. Restart all the cloudcore and edgecore.

    At the cloud side:

    复制代码
    sudo systemctl restart cloudcore.service

    At the edge side:

    复制代码
    sudo systemctl restart edgecore.service
相关推荐
黄诂多1 小时前
APP原生与H5互调Bridge技术原理及基础使用
前端
前端市界1 小时前
用 React 手搓一个 3D 翻页书籍组件,呼吸海浪式翻页,交互体验带感!
前端·架构·github
文艺理科生1 小时前
Nginx 路径映射深度解析:从本地开发到生产交付的底层哲学
前端·后端·架构
千寻girling1 小时前
主管:”人家 Node 框架都用 Nest.js 了 , 你怎么还在用 Express ?“
前端·后端·面试
C澒1 小时前
Vue 项目渐进式迁移 React:组件库接入与跨框架协同技术方案
前端·vue.js·react.js·架构·系统架构
清山博客2 小时前
OpenCV 人脸识别和比对工具
前端·webpack·node.js
要加油哦~2 小时前
AI | 实践教程 - ScreenCoder | 多agents前端代码生成
前端·javascript·人工智能
程序员Sunday2 小时前
说点不一样的。GPT-5.3 与 Claude Opus 4.6 同时炸场,前端变天了?
前端·gpt·状态模式
yq1982043011562 小时前
静思书屋:基于Java Web技术栈构建高性能图书信息平台实践
java·开发语言·前端
aPurpleBerry2 小时前
monorepo (Monolithic Repository) pnpm rush
前端