为响应政策,最近在捣鼓国产化云原生平台的搭建。在搭建过程中遇到了问题记录下来,以备后续查找。
我选用了中国电子云的云平台来搭建K8S集群,选用的技术栈是华为开源的openeuler+k8s+isulad框架,参考官网文档资料:iSulad+k8s环境部署 | 文档 | openEuler社区
搭建过程中遇到的第二个问题是:crictl使用问题
在openeuler+k8s+isulad框架中,华为的技术栈使用isulad进行容器管理,替代了原生docker和后来的containerd容器组件。其使用方法和docker、containerd类似,只不过isulad的cri套接字连接文件是"unix:///var/run/isulad.sock",配置文件中需要把连接文件配置好,不然isulad无法正常和k8s的API通信。除此之外华为还为其开发了另一个管理工具crictl,其使用和isula差不多。
按照官网的安装步骤,重启isulad服务后,安装cri-tools,crictl就可以正常使用了,但是我的操作结果是
//官网
添加完成后启动服务。
# systemctl daemon-reload
# systemctl enable br_netfilter.service (这里拼写错误,应该是br_netfilte.service)
下面的结果:
//sudo crictl info
DEBU[0000] get runtime connection
FATA[0000] validate service connection: validate CRI v1 runtime API for endpoint "unix:///var/run/isulad.sock": rpc error: code = Unimplemented desc =
使用DeepSeek或者用腾讯元宝(模型也是用的DeepSeek)分析,是因为没有写配置文件。
按照AI给出的方案对其配置:
创建或编辑配置文件 `/etc/crictl.yaml`:
```yaml
runtime-endpoint: "unix:///var/run/isulad.sock" # iSulad 的 CRI 套接字
image-endpoint: "unix:///var/run/isulad.sock"
timeout: 10
debug: true
重启isulad,结果还是一样,问题依旧存在。
使用AI继续分析,认为是isulad的网络支持问题。看官网中/etc/isulad/daemon.json的配置:
"network-plugin": "cni",
"cni-bin-dir": "/opt/cni/bin",
"cni-conf-dir": "/etc/cni/net.d",
查看宿主机上/etc/cni/net.d 和 /opt/cni/bin 中均为空,认为是isulad的网络插件没有安装,安装AI给出的方案安装CNI插件
//安装cni组件
sudo yum install -y containernetworking-plugins runc lxc lcr
// 查看cni目录
sudo rpm -ql containernetworking-plugins |grep cni
sudo mkdir -p /opt/cni/bin
sudo mkdir -p /etc/cni/net.d
# 链接 CNI 插件(如果 containernetworking-plugins 安装到其他位置)
if [ -d "/usr/libexec/cni" ]; then
sudo ln -s /usr/libexec/cni/* /opt/cni/bin/
fi
sudo tee /etc/cni/net.d/10-isulad-bridge.conf <<'EOF'
{
"cniVersion": "0.4.0",
"name": "isulad-bridge",
"type": "bridge",
"bridge": "cni0",
"isGateway": true,
"ipMasq": true,
"ipam": {
"type": "host-local",
"subnet": "10.22.0.0/16",
"routes": [
{ "dst": "0.0.0.0/0" }
]
}
}
按照上述配置问题依旧没解决,后来再问AI感觉没有太多有价值的内容,感觉问题不在于此。于是就想去官网论坛上碰碰运气(isulad CRI接口调用失败 - isulad - openEuler 论坛) 发现是因为/etc/isulad/daemon.json配置文件中没有配置cri的相关内容:
在其配置文件中增加两条内容:
sudo vim /etc/isulad/daemon.json
//需要按照官网配置的同时添加
"enable-cri-v1": true,
"websocket-server-listening-port": 10350
重新启动isulad 问题解决了。
//crictl info
//
DEBU[0000] get runtime connection
DEBU[0000] StatusRequest: &StatusRequest{Verbose:true,}
DEBU[0000] StatusResponse: &StatusResponse{Status:&RuntimeStatus{Conditions:[]*RuntimeCondition{&RuntimeCondition{Type:RuntimeReady,Status:true,Reason:,Message:,},&RuntimeCondition{Type:NetworkReady,Status:true,Reason:,Message:,},},},Info:map[string]string{},}
{
"status": {
"conditions": [
{
"type": "RuntimeReady",
"status": true,
"reason": "",
"message": ""
},
{
"type": "NetworkReady",
"status": true,
"reason": "",
"message": ""
}
]
}
}
在后续安装过程中,发现这个阶段不用配置cni和安装isulad的网络插件,因为使用kubeadm reset 重新安装k8s时还需要删除sudo rm -rf /etc/kubernetes/pki /var/lib/etcd /etc/cni/net.d/ 所以前面的网络配置没有意义,k8s的网络是通过后续的calico组件的安装建立起来的,所以前面使用DeepSeek查找的解决方案有一部分是不需要设置的。
总结,AI大模型盛行的当下,技术论坛还是有其作用的,尤其对于国产化,相对不太成熟的生态,资料相对比较少,官网和技术大牛的解决方案往往会更优于AI大模型。