遇到的问题
使用Kubespray、CRI-O和Cilium部署集群时,我收到一个错误,提示有多个 CRI 套接字可供选择。
完全错误
fatal: [p3kubemaster1]: FAILED! => {"changed": true, "cmd": " mkdir -p /etc/kubernetes/external_kubeconfig && /usr/local/bin/kubeadm init phase kubeconfig admin --kubeconfig-dir /etc/kubernetes/external_kubeconfig --cert-dir /etc/kubernetes/ssl --apiserver-advertise-address 10.10.3.15 --apiserver-bind-port 6443 >/dev/null && cat /etc/kubernetes/external_kubeconfig/admin.conf && rm -rf /etc/kubernetes/external_kubeconfig ", "delta": "0:00:00.028808", "end": "2019-09-02 13:01:11.472480", "msg": "non-zero return code", "rc": 1, "start": "2019-09-02 13:01:11.443672", "stderr": "Found multiple CRI sockets, please use --cri-socket to select one: /var/run/dockershim.sock, /var/run/crio/crio.sock", "stderr_lines": ["Found multiple CRI sockets, please use --cri-socket to select one: /var/run/dockershim.sock, /var/run/crio/crio.sock"], "stdout": "", "stdout_lines": []}
有趣的部分
kubeadm init phase kubeconfig admin --kubeconfig-dir /etc/kubernetes/external_kubeconfig [...] >/dev/null,"stderr": "Found multiple CRI sockets, please use --cri-socket to select one: /var/run/dockershim.sock, /var/run/crio/crio.sock"}
我试过的
- 1)我试图在
--cri-socket
里面设置标志/var/lib/kubelet/kubeadm-flags.env
:
KUBELET_KUBEADM_ARGS="--container-runtime=remote --container-runtime-endpoint=/var/run/crio/crio.sock --cri-socket=/var/run/crio/crio.sock"
=> 没有区别
- 2)我已经检查过
/etc/kubernetes/kubeadm-config.yaml
,但它已经包含以下部分:
apiVersion: kubeadm.k8s.io/v1beta2
kind: InitConfiguration
localAPIEndpoint:
advertiseAddress: 10.10.3.15
bindPort: 6443
certificateKey: 9063a1ccc9c5e926e02f245c06b8d9f2ff3xxxxxxxxxxxx
nodeRegistration:
name: p3kubemaster1
taints:
- effect: NoSchedule
key: node-role.kubernetes.io/master
criSocket: /var/run/crio/crio.sock
=> 它已经以criSocket
标志结束,所以无事可做......
- 3) 尝试编辑 ansible 脚本以将其添加
--cri-socket
到现有命令中,但失败并显示Unknow command --cri-socket
现存的 :
{% if kubeadm_version is version('v1.14.0', '>=') %}
init phase`
试过:
{% if kubeadm_version is version('v1.14.0', '>=') %}
init phase --crio socket /var/run/crio/crio.sock`
理论
似乎问题来自与标志 kubeadm init phase
不兼容的命令......(见第3点)--crio-socket
即使使用配置文件设置了正确的套接字(参见第 2 点),kubeadm init phase
也没有使用它。
任何想法都会被欣赏;-)
thx