Search code examples
kubernetessystemdcgroupscri-o

use cri-o to run pod and container when `cgroup_manager=systemd`


I successfully use cri-o to run pod and container, following the guide and tutorial, whose default cgroup_manager is cgroupfs.

when I tried to set cgroup_manager = "systemd" in /etc/crio/crio.conf and restart crio service.

then, I tried the same steps in tutorial

POD_ID=$(sudo crictl runp test/testdata/sandbox_config.json)

got the error below:

FATA[0000] run pod sandbox failed: rpc error: code = Unknown desc = cri-o configured with systemd cgroup manager, but did not receive slice as parent: /Burstable/pod_123-456

the sandbox_config.json is same as sandbox_config.json

How to use cri-o to start pod and container when cgroup_manager=systemd? Is there a sample?


Solution

  • When you switch the cgroup manager to systemd in /etc/crio/crio.conf, you have to modify the pod yaml/json to give the cgroup_parent a slice instead. So in your sandbox_config.json change

    "linux": {
            "cgroup_parent": "/Burstable/pod_123-456",
    

    to something like this

    "linux": {
            "cgroup_parent": "podabc.slice",
    

    Try re-creating your pod and it should start up fine now.