How to setup k8s cluster base on kata + containerd
Ref to doc: https://github.com/kata-containers/documentation/tree/master/how-to
I'm working on clearlinux os and I hope to setup k8s cluster base on kata+containerd. I expect to replace runc completely with kata-runtime( make all images including kube-apiserver, kube-scheduler.. and the other are running in kata container)
$ kata-runtime version
kata-runtime : 1.2.0
commit : 0bcb32f7042625ea0ecee8f37b99b4459ebd5af8
OCI specs: 1.0.1
my configuration and operation steps is as follows:
- configure kata as default runtime
/etc/containerd/config.toml
[plugins.cri.containerd.default_runtime]
runtime_type = "io.containerd.kata.v2"
-
Disable service docker, crio, only enable service containerd
-
Init k8s master
$ sudo kubeadm init --pod-network-cidr=10.244.0.0/16
But I found that "kubeadm init" fail due to "Initial timeout of 40s passed."
check container's status:
# crictl -r unix:///var/run/containerd/containerd.sock ps -a
CONTAINER ID IMAGE CREATED STATE NAME ATTEMPT POD ID
e814eee84e358 5eeff402b6598 29 seconds ago Exited kube-apiserver 2 83c520b5f028d
967ddc5334b48 2c4adeb21b4ff 40 seconds ago Exited etcd 3 2626d1e35d388
5524c94f83cd5 8be94bdae1399 About a minute ago Exited kube-controller-manager 0 38e31191303a1
1baaa9049479e ee18f350636d8 About a minute ago Exited kube-scheduler 0 e65a1d19c2b32
It looks like that the container "kube-controller-manager", "kube-apiserver", "kube-scheduler" are unable to be run in kata runtime.
My question is :
Is this behavior as expect? If no, what other operations I have missed?
Hi @shaoyuta Based on my experience, you shouldn't set the kata as the default runtime, instead you should set it as another runtimeClass, and set runc as the default runtime, thus the system pods such as kube-apiserver, etcd etc can use runc to run. And run your app pod using the kata runtimeClass.
Hi @lifupan , Thanks a lot. Do kata team has a plan to support such feature ?
Hi @lifupan , Thanks a lot. Do kata team has a plan to support such feature ?
I don't think so, since those system pods will use the host network namespace, which is conflict with kata network, that's why kata container failed to setup for those system pods. For those system pods, I think it's ok to use runc.
Even though resolved, /cc @mcastelino @krsna1729 @ganeshmaharaj - yes, I believe you cannot run just kata for all the pods and services, as some of them are effectively 'full priv containers', which Kata cannot support.
Also host netns containers