Skip to content

Instantly share code, notes, and snippets.

@uablrek
Last active April 5, 2024 08:38
Show Gist options
  • Save uablrek/7843c49904b79873a5f7ebec0b7535fd to your computer and use it in GitHub Desktop.
Save uablrek/7843c49904b79873a5f7ebec0b7535fd to your computer and use it in GitHub Desktop.
OCI state in containerd and cri-o

When trying https://github.com/LionelJouin/network-dra with crio instead of containerd it fails. The reason, or at least the first encountered problem, is that the OCI state differs:

Containerd:

{
  "ociVersion": "1.0.2-dev",
  "id": "f8a629809a08c9b1c45fae0fd34328dc29ece873cbe1ece14aaf35a2e370042b",
  "status": "creating",
  "pid": 1151,
  "bundle": "/run/containerd/io.containerd.runtime.v2.task/k8s.io/f8a629809a08c9b1c45fae0fd34328dc29ece873cbe1ece14aaf35a2e370042b",
  "annotations": {
    "io.kubernetes.cri.container-name": "alpine",
    "io.kubernetes.cri.container-type": "container",
    "io.kubernetes.cri.image-name": "docker.io/library/alpine:latest",
    "io.kubernetes.cri.sandbox-id": "d68b80e63aa556308cce9fb7fc13e4a686e43fdc9ee019b0ea17f37fd3520877",
    "io.kubernetes.cri.sandbox-name": "demo-a",
    "io.kubernetes.cri.sandbox-namespace": "default",
    "io.kubernetes.cri.sandbox-uid": "421dd87d-cc87-4d13-8491-15eb2a9e7252"
  }
}

Crio:

{
  "ociVersion": "1.0.2-dev",
  "id": "7341fe7619fc77ec48fafcc610420ef1d4ea3fb73113c561bb9af784af40876c",
  "status": "creating",
  "pid": 1114,
  "bundle": "/run/containers/storage/overlay-containers/7341fe7619fc77ec48fafcc610420ef1d4ea3fb73113c561bb9af784af40876c/userdata",
  "annotations": {
    "cdi.k8s.io/dra.networking_51a277f1-310d-4e55-a7de-f41bcc31bc6b": "k8s.dra.networking/attachment=51a277f1-310d-4e55-a7de-f41bcc31bc6b",
    "io.container.manager": "cri-o",
    "io.kubernetes.container.hash": "2f75898c",
    "io.kubernetes.container.name": "alpine",
    "io.kubernetes.container.restartCount": "0",
    "io.kubernetes.container.terminationMessagePath": "/dev/termination-log",
    "io.kubernetes.container.terminationMessagePolicy": "File",
    "io.kubernetes.cri-o.Annotations": "{\"cdi.k8s.io/dra.networking_51a277f1-310d-4e55-a7de-f41bcc31bc6b\":\"k8s.dra.networking/attachment=51a277f1-310d-4e55-a7de-f41bcc31bc6b\",\"io.kubernetes.container.hash\":\"2f75898c\",\"io.kubernetes.container.restartCount\":\"0\",\"io.kubernetes.container.terminationMessagePath\":\"/dev/termination-log\",\"io.kubernetes.container.terminationMessagePolicy\":\"File\",\"io.kubernetes.pod.terminationGracePeriod\":\"30\"}",
    "io.kubernetes.cri-o.ContainerID": "7341fe7619fc77ec48fafcc610420ef1d4ea3fb73113c561bb9af784af40876c",
    "io.kubernetes.cri-o.ContainerType": "container",
    "io.kubernetes.cri-o.Created": "2024-04-05T08:07:47.485049783Z",
    "io.kubernetes.cri-o.IP.0": "11.0.2.4",
    "io.kubernetes.cri-o.IP.1": "1100::204",
    "io.kubernetes.cri-o.Image": "172.17.0.2/alpine@sha256:6457d53fb065d6f250e1504b9bc42d5b6c65941d57532c072d929dd0628977d0",
    "io.kubernetes.cri-o.ImageName": "172.17.0.2/alpine:latest",
    "io.kubernetes.cri-o.ImageRef": "05455a08881ea9cf0e752bc48e61bbd71a34c029bb13df01e40e3e70e0d007bd",
    "io.kubernetes.cri-o.Labels": "{\"io.kubernetes.container.name\":\"alpine\",\"io.kubernetes.pod.name\":\"demo-a\",\"io.kubernetes.pod.namespace\":\"default\",\"io.kubernetes.pod.uid\":\"738fce64-257e-4c1c-aeb7-24af9fac2bcd\"}",
    "io.kubernetes.cri-o.LogPath": "/var/log/pods/default_demo-a_738fce64-257e-4c1c-aeb7-24af9fac2bcd/alpine/0.log",
    "io.kubernetes.cri-o.Metadata": "{\"name\":\"alpine\"}",
    "io.kubernetes.cri-o.MountPoint": "/var/lib/containers/storage/overlay/b38d452e65ac80ace261eefc06fa239f9fc21ed4bf36d5b2a47c6c7f7d4a9108/merged",
    "io.kubernetes.cri-o.Name": "k8s_alpine_demo-a_default_738fce64-257e-4c1c-aeb7-24af9fac2bcd_0",
    "io.kubernetes.cri-o.PlatformRuntimePath": "",
    "io.kubernetes.cri-o.ResolvPath": "/run/containers/storage/overlay-containers/b80818dac0d6fc150cafd577c4ad7567cb347feb2d3ac0db756a755757e1857c/userdata/resolv.conf",
    "io.kubernetes.cri-o.SandboxID": "b80818dac0d6fc150cafd577c4ad7567cb347feb2d3ac0db756a755757e1857c",
    "io.kubernetes.cri-o.SandboxName": "k8s_demo-a_default_738fce64-257e-4c1c-aeb7-24af9fac2bcd_0",
    "io.kubernetes.cri-o.SeccompProfilePath": "Unconfined",
    "io.kubernetes.cri-o.Stdin": "false",
    "io.kubernetes.cri-o.StdinOnce": "false",
    "io.kubernetes.cri-o.TTY": "false",
    "io.kubernetes.cri-o.Volumes": "[{\"container_path\":\"/etc/hosts\",\"host_path\":\"/var/lib/kubelet/pods/738fce64-257e-4c1c-aeb7-24af9fac2bcd/etc-hosts\",\"readonly\":false,\"propagation\":0,\"selinux_relabel\":false},{\"container_path\":\"/dev/termination-log\",\"host_path\":\"/var/lib/kubelet/pods/738fce64-257e-4c1c-aeb7-24af9fac2bcd/containers/alpine/ac0e6975\",\"readonly\":false,\"propagation\":0,\"selinux_relabel\":false},{\"container_path\":\"/var/run/secrets/kubernetes.io/serviceaccount\",\"host_path\":\"/var/lib/kubelet/pods/738fce64-257e-4c1c-aeb7-24af9fac2bcd/volumes/kubernetes.io~projected/kube-api-access-npg4j\",\"readonly\":true,\"propagation\":0,\"selinux_relabel\":false}]",
    "io.kubernetes.pod.name": "demo-a",
    "io.kubernetes.pod.namespace": "default",
    "io.kubernetes.pod.terminationGracePeriod": "30",
    "io.kubernetes.pod.uid": "738fce64-257e-4c1c-aeb7-24af9fac2bcd",
    "kubernetes.io/config.seen": "2024-04-05T08:07:46.893392369Z",
    "kubernetes.io/config.source": "api"
  }
}

The reported error is:

error CreateRuntime: rpc error: code = Unknown desc = io.kubernetes.cri.sandbox-id doesn't exist in ociState
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment