podman icon indicating copy to clipboard operation
podman copied to clipboard

Support shim v2 e.g. for Kata Containers 2.0

Open c3d opened this issue 6 years ago • 40 comments

/kind feature

Description

Adding support for the shimv2 interface https://alibaba-cloud.medium.com/cri-and-shimv2-a-new-idea-for-kubernetes-integrating-container-runtime-ab8d22f5716b, useful for example for Kata Containers version 2.0 which no longer supports the earlier CRI interface (see https://github.com/kata-containers/kata-containers/issues/1133#issuecomment-731153881).

Steps to reproduce the issue:

podman run -it --runtime kata fedora bash

That works with kata being kata-runtime (Kata Containers version 1.0) but not with containerd-shim-kata-v2 (Kata Containers version 2.0).

Output of podman version:

Version:      2.1.1
API Version:  2.0.0
Go Version:   go1.15.2
Built:        Wed Oct  7 18:21:20 2020
OS/Arch:      linux/amd64

Output of podman info --debug:

host:
  arch: amd64
  buildahVersion: 1.16.1
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: Unknown
    path: /usr/libexec/podman/conmon
    version: 'conmon version 2.0.11-dev, commit: 77f4a5131bfc344ab4485cd3f1e4644bfa2122e2'
  cpus: 12
  distribution:
    distribution: fedora
    version: "33"
  eventLogger: journald
  hostname: turbo.dinechin.lan
  idMappings:
    gidmap: null
    uidmap: null
  kernel: 5.9.8-200.fc33.x86_64
  linkmode: dynamic
  memFree: 1521201152
  memTotal: 33522884608
  ociRuntime:
    name: crun
    package: crun-0.15.1-1.fc33.x86_64
    path: /usr/bin/crun
    version: |-
      crun version 0.15.1
      commit: eb0145e5ad4d8207e84a327248af76663d4e50dd
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +YAJL
  os: linux
  remoteSocket:
    path: /run/podman/podman.sock
  rootless: false
  slirp4netns:
    executable: ""
    package: ""
    version: ""
  swapFree: 99739828224
  swapTotal: 103846764544
  uptime: 72h 44m 18.82s (Approximately 3.00 days)
registries:
  search:
  - registry.fedoraproject.org
  - registry.access.redhat.com
  - registry.centos.org
  - docker.io
store:
  configFile: /etc/containers/storage.conf
  containerStore:
    number: 1
    paused: 0
    running: 1
    stopped: 0
  graphDriverName: overlay
  graphOptions:
    overlay.mountopt: nodev,metacopy=on
  graphRoot: /var/lib/containers/storage
  graphStatus:
    Backing Filesystem: extfs
    Native Overlay Diff: "false"
    Supports d_type: "true"
    Using metacopy: "true"
  imageStore:
    number: 5
  runRoot: /var/run/containers/storage
  volumePath: /var/lib/containers/storage/volumes
version:
  APIVersion: 2.0.0
  Built: 1602087680
  BuiltTime: Wed Oct  7 18:21:20 2020
  GitCommit: ""
  GoVersion: go1.15.2
  OsArch: linux/amd64
  Version: 2.1.1

Package info (e.g. output of rpm -q podman or apt list podman):

podman-2.1.1-12.fc33.x86_64

Have you tested with the latest version of Podman and have you checked the Podman Troubleshooting Guide?

No (but I don't expect the latest has the fix, not having seen a mention of "shim v2" in the issues)

Additional environment details (AWS, VirtualBox, physical, etc.):

Physical with Kata

Note

Kata Containers is considering doing the opposite, which is to restore the original CLI commands, see https://github.com/kata-containers/kata-containers/issues/722. However, that would lead to a more inefficient setup (multiple shims), so the shimv2 interface remains interesting in the long run.

c3d avatar Dec 03 '20 15:12 c3d

Interested in opening a PR to fix. I am not sure if this would be easy unless we have a small wrapper OCI that would do the magic for us. Making the changes for podman to connect to a socket, would be a lot more invasive.

rhatdan avatar Dec 07 '20 15:12 rhatdan

Doing this properly would be a pretty significant endeavour - we do have an OCI runtime abstraction but some aspects of our current pattern (e.g. Conmon) are baked deeply into parts of Libpod, including the aforementioned abstraction interface.

mheon avatar Dec 07 '20 16:12 mheon

A friendly reminder that this issue had no activity for 30 days.

github-actions[bot] avatar Jan 07 '21 00:01 github-actions[bot]

A friendly reminder that this issue had no activity for 30 days.

github-actions[bot] avatar Feb 07 '21 00:02 github-actions[bot]

A friendly reminder that this issue had no activity for 30 days.

github-actions[bot] avatar Mar 14 '21 00:03 github-actions[bot]

BTW, the alternative is to get crio supported in nerdctl.

ghost avatar Apr 07 '21 20:04 ghost

A friendly reminder that this issue had no activity for 30 days.

github-actions[bot] avatar May 08 '21 00:05 github-actions[bot]

If this is still wanted and can be added, I would like to give it a try. Based on the comments it seems it is not an easy task, so it might take me some time to understand and get the required changes, but if that's not a problem I'm ok with start doing something here.

EduardoVega avatar May 08 '21 17:05 EduardoVega

If you’re willing to take a shot, go for it! We can probably do this in pieces, migrate support in parts (stuff like attach handling is especially hard to get right, for example)

On Sat, May 8, 2021 at 14:00 Eduardo Vega @.***> wrote:

If this is still wanted and can be added, I would like to give it a try. Based on the comments it seems it is not an easy task, so it might take me some time to understand and get the required changes, but if that's not a problem I'm ok with start doing something here.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/containers/podman/issues/8579#issuecomment-835450195, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB3AOCEPIEVZMP7KHCBOIMDTMV3Z7ANCNFSM4UMDU45Q .

mheon avatar May 09 '21 15:05 mheon

@mheon understood.

So the idea would be to implement a shimv2 client, so that shims like containerd-shim-kata-v2 can be used with podman.

podman -> OCI wrapper -> shimv2 -> ctrs

In this case conmon wouldn't be part of this, since the shim should take care of the container?

For the initial work, what would you consider can be a good start ? I was thinking to start with a very simple create / start operation

I hope this makes sense.

EduardoVega avatar May 12 '21 00:05 EduardoVega

Sure. This sounds reasonable. It should give us an idea of how complex this could get.

On Tue, May 11, 2021 at 20:37 Eduardo Vega @.***> wrote:

@mheon https://github.com/mheon understood.

So the idea would be to implement a shimv2 client, so that shims like containerd-shim-kata-v2 can be used with podman.

podman -> OCI wrapper -> shimv2 -> ctrs

In this case conmon wouldn't be part of this, since the shim should take care of the container?

For the initial work, what would you consider can be a good start ? I was thinking to start with a very simple create / start operation

I hope this makes sense.

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/containers/podman/issues/8579#issuecomment-839337204, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB3AOCAO6MZZSAIRAF6RGGDTNHEV5ANCNFSM4UMDU45Q .

mheon avatar May 12 '21 09:05 mheon

A friendly reminder that this issue had no activity for 30 days.

github-actions[bot] avatar Jun 18 '21 00:06 github-actions[bot]

Still working on this. I've been able to get some progress and now trying to get a minimal attach workflow working (podman run without -d flag)

EduardoVega avatar Jun 18 '21 00:06 EduardoVega

A friendly reminder that this issue had no activity for 30 days.

github-actions[bot] avatar Jul 30 '21 00:07 github-actions[bot]

@EduardoVega What is going on with this?

rhatdan avatar Aug 01 '21 11:08 rhatdan

@rhatdan I haven't been able to get any progress for the last weeks due to the lack of time, but I should be able to start working on this and finalize what I have done so far for the initial PoC

EduardoVega avatar Aug 04 '21 02:08 EduardoVega

$ kata-runtime --help

NAME:
   kata-runtime - kata-runtime runtime

kata-runtime is a command line program for running applications packaged
according to the Open Container Initiative (OCI).

USAGE:
   kata-runtime [global options] command [command options] [arguments...]

VERSION:
   kata-runtime  : 2.1.1
   commit   : 4198b524c828f75eb164b2160d7b676d1c537f4b
   OCI specs: 1.0.1-dev

COMMANDS:
     version            display version details
     check, kata-check  tests if system can run Kata Containers
     env, kata-env      display settings. Default to TOML
     exec               Enter into guest by debug console
     metrics            gather metrics associated with infrastructure used to run a sandbox
     factory            manage vm factory
     help, h            Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --config value, --kata-config value                            Kata Containers config file path
   --log value                                                    set the log file path where internal debug information is written (default: "/dev/null")
   --log-format value                                             set the format used by logs ('text' (default), or 'json') (default: "text")
   --root value                                                   root directory for storage of container state (this should be located in tmpfs) (default: "/var/run/kata-containers")
   --rootless value                                               ignore cgroup permission errors ('true', 'false', or 'auto') (default: "auto")
   --show-default-config-paths, --kata-show-default-config-paths  show config file paths that will be checked for (in order)
   --systemd-cgroup                                               enable systemd cgroup support, expects cgroupsPath to be of form "slice:prefix:name" for e.g. "system.slice:runc:434234"
   --help, -h                                                     show help
   --version, -v                                                  print the version

NOTES:

- Commands starting "kata-" and options starting "--kata-" are Kata Containers extensions.

URL:

  The canonical URL for this project is: https://github.com/kata-containers

kata's OCI is deprecated?

unknowndevQwQ avatar Aug 07 '21 15:08 unknowndevQwQ

A friendly reminder that this issue had no activity for 30 days.

github-actions[bot] avatar Sep 08 '21 00:09 github-actions[bot]

Still WIP

EduardoVega avatar Sep 08 '21 12:09 EduardoVega

@EduardoVega anything you can share with us? Thanks.

zvonkok avatar Oct 07 '21 13:10 zvonkok