在 LoongArch 架构的 Kubernetes 集群部署中,用户遇到了一系列关于 containerd、Flannel 和 MetalLB 的问题。集群节点运行的是 LoongArch 架构的 Linux 系统,Kubernetes 版本为 1.29,部分容器镜像为 LoongArch 原生或多架构镜像。
关键背景信息:
containerd-custom来单独管理某些容器运行环境和镜像源,避免影响系统默认 containerd。containerd-custom使用独立配置文件/etc/containerd-custom/config.toml,可以单独配置镜像代理(mirrors)和其他参数。在部署过程中,containerd-custom服务无法启动,日志显示 TOML 配置解析失败:
failed to load TOML: /etc/containerd-custom/config.toml: (137, 29): no value can start with t
containerd-custom的独立配置文件中,而不是系统默认 containerd。ShimCgroup = "" SystemdCgroup = ture
SystemdCgroup = true
/etc/containerd-custom/config.toml可独立影响 containerd-custom 的行为。[plugins."io.containerd.grpc.v1.cri".registry.mirrors."my.registry.local"] endpoint = ["https://my.registry.local"]
部署 MetalLB 后,Speaker Pod 出现连续重启:
Normal Scheduled Successfully assigned metallb-system/speaker-l69ww to localhost.localdomain Normal Pulling Pulling image "metallb/speaker:0.15.2" Normal Pulled Successfully pulled image Normal Created Created container speaker Warning BackOff Back-off restarting failed container speaker
查看 Pod 日志:
2025/09/23 02:12:14 github.com/josharian/native: unrecognized arch loong64 {"msg":"MetalLB speaker starting version 0.15.2"} {"error":"Could not set up network transport: failed to obtain an address: Failed to start TCP listener on \"10.130.0.20\" port 7946: bind: address already in use"}
dockerd占用 7946 端口:sudo lsof -i :7946 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME dockerd 2193941 root 20u IPv6 13031352 0t0 TCP *:7946 (LISTEN)
hostNetwork: true时,hostPort必须与containerPort相同,否则会报错:The DaemonSet "speaker" is invalid: spec.template.spec.containers[0].ports[1].hostPort: Invalid value: 7947: must match `containerPort` when `hostNetwork` is true
containers: - args: - --port=7472 - --log-level=info - --ml-bindport=7947 # 新端口 ports: - containerPort: 7472 name: monitoring - containerPort: 7947 name: memberlist-tcp - containerPort: 7947 name: memberlist-udp
--ml-bindport指定 Speaker 内部使用的 memberlist 端口。containerPort也修改为同样的端口,满足hostNetwork: true的约束。kubectl apply -f metallb-native.yaml
kubectl get pods -n metallb-system kubectl logs speaker-l69ww -n metallb-system
本次排查总结如下:
containerd-custom可以独立配置镜像代理,不影响系统默认 containerd。--ml-bindport配置新端口,并同步修改containerPort可以解决 hostNetwork 冲突问题。