Skip to content
gobomb edited this page Aug 2, 2019 · 4 revisions

使用crio 作为 kubelet runtime

安装 crio

yum-config-manager --add-repo=https://cbs.centos.org/repos/paas7-crio-311-candidate/x86_64/os/
yum install --nogpgcheck cri-o

(若缺乏 yum-config-manager 则 yum -y install yum-utils)

vim /lib/systemd/system/kubelet.service 加上 --container-runtime=remote --container-runtime-endpoint=/var/run/crio/crio.sock --cgroup-driver=systemd

/k8s/kubernetes/bin/kubelet $KUBELET_OPTS --container-runtime=remote --container-runtime-endpoint=/var/run/crio/crio.sock --cgroup-driver=systemd

vim /usr/lib/systemd/system/crio.service 修改 ExecStart 指定配置文件 --config /etc/crio/crio.conf

vim /etc/crio/crio.conf 指定 oci-runtime / pause-image / insecure_registries 等信息

启动 crio

systemctl start crio

[root@master ~]# crictl version
Version:  0.1.0
RuntimeName:  cri-o
RuntimeVersion:  1.11.11-1.rhaos3.11.git474f73d.el7
RuntimeApiVersion:  v1alpha1

重启 kubelet

systemctl restart kubelet

问题

启动问题

  Warning  FailedCreatePodSandBox  4m26s (x11 over 6m42s)  kubelet, 10.10.13.61  Failed create pod sandbox: rpc error: code = Unknown desc = cri-o configured with systemd cgroup manager, but did not receive slice as parent: /kubepods/besteffort/pod7e275348-ac31-11e9-b88b-00505699ed79

kubelet 添加参数 --cgroup-driver=systemd

https://fufu.gitbook.io/kk8s/fix-kubelet-kubeadm-init

启动遇到 Aug 02 17:02:58 node02 crio[18443]: time="2019-08-02 17:02:58.374826399+08:00" level=error msg="watcher.Add("/usr/share/containers/oci/hooks.d") failed: no such file or directory"

[root@node02 ~]# ls /usr/share/containers/oci/hooks.d
ls: cannot access /usr/share/containers/oci/hooks.d: No such file or directory
[root@node02 ~]# mkdir /usr/share/containers/oci/
[root@node02 ~]# mkdir /usr/share/containers/oci/hooks.d
[root@node02 ~]# systemctl restart crio
Clone this wiki locally