Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

re-add OCI CLI commands for podman (Note: docker is now supported with docker-23.0) #722

Open
jodh-intel opened this issue Sep 15, 2020 · 14 comments
Assignees
Labels
area/cli Command Line Interface (flags/options and arguments) enhancement Improvement to an existing feature kata-2.0-features Features introduced in Kata 2.0

Comments

@jodh-intel
Copy link
Contributor

We should consider re-adding the OCI commands (removed on #332, #363) so we can support docker and podman with Kata 2.0 (since those container manager do not support shim v2 (yet).

@c3d
Copy link
Member

c3d commented Dec 3, 2020

For the record (to make search easier), here is what you get when you try:

#  podman run -it --rm  --runtime /usr/local/kata/usr/local/bin/containerd-shim-kata-v2  fedora bash                                 io.containerd.kata.v2: shim namespace cannot be empty
ERRO[0005] Error removing container 3a073fca6248bd92d5e9917d49df7220fc5113d64664901596b5621777049f95 from runtime after creation failed 
Error: flag provided but not defined: -systemd-cgroup
Usage of /usr/local/kata/usr/local/bin/containerd-shim-kata-v2:
  -address string
    	grpc address back to main containerd
  -bundle string
    	path to the bundle if not workdir
  -debug
    	enable debug output in logs
  -id string
    	id of the task
  -namespace string
    	namespace that owns the shim
  -publish-binary string
    	path to publish binary (used for publishing events) (default "containerd")
  -socket string
    	abstract socket path to serve: OCI runtime error

@c3d
Copy link
Member

c3d commented Dec 3, 2020

See also #1133 (comment)

@zer0def
Copy link

zer0def commented May 17, 2021

Just for the record, you can still use Kata v1 with current latest LTS kernel (at the time of writing, 5.10.37, or at least that's what I just tested with) to have an OCI/shimv1 interface for Docker to talk through, since their v2 implementation leaves a lot to expect.

While not a recommended or maintained solution, you can at least stretch it out a bit until this issue is resolved.

zer0def pushed a commit to zer0def/PKGBUILDs that referenced this issue May 17, 2021
…btrfs

Until kata-containers/kata-containers#722 gets fixed, this is the only
feasible way to get a decent OCI interface.
@fidencio
Copy link
Member

Just for the record, you can still use Kata v1 with current latest LTS kernel (at the time of writing, 5.10.37, or at least that's what I just tested with) to have an OCI/shimv1 interface for Docker to talk through, since their v2 implementation leaves a lot to expect.

While not a recommended or maintained solution, you can at least stretch it out a bit until this issue is resolved.

You can, it's just not maintained, out-of-support, and highly discouraged to do so.

@c3d
Copy link
Member

c3d commented Sep 1, 2021

The opposite side of this for podman is containers/podman#8579

@c3d c3d self-assigned this Oct 12, 2021
c3d added a commit to c3d/kata-containers that referenced this issue May 5, 2022
Typo in comment, s/implemenation/implementation/

Fixes: kata-containers#722

Signed-off-by: Christophe de Dinechin <dinechin@redhat.com>
c3d added a commit to c3d/kata-containers that referenced this issue May 5, 2022
The types that were removed are required for CLI commands
that we want to rebuild in order to restore podman functionality.

This is based on a revert of
"runtime: delete types or const that no longer needed"
commit 39ffd8e.

Fixes: kata-containers#722

Signed-off-by: Christophe de Dinechin <dinechin@redhat.com>
c3d added a commit to c3d/kata-containers that referenced this issue May 5, 2022
This function was removed as part of a cleanup by Peng Tao
in commit 74192d1.
It is used by some of the APIs we are trying to recover in order to restore
podman functionality

Fixes: kata-containers#722

Signed-off-by: Christophe de Dinechin <dinechin@redhat.com>
c3d added a commit to c3d/kata-containers that referenced this issue May 5, 2022
The APIs that were deleted are necessary for the restoration of podman support.
This is essentially a revert of Bin Liu's commit
"virtcontainers: cleanup codes, delete not used APIs"
commit e7d3ba1.

Fixes: kata-containers#722

Signed-off-by: Christophe de Dinechin <dinechin@redhat.com>
c3d added a commit to c3d/kata-containers that referenced this issue May 5, 2022
The old API code restored from reverting an earlier commits uses the previous
tracing mode. Convert the various tracing calls to the new form.

Fixes: kata-containers#722

Signed-off-by: Christophe de Dinechin <dinechin@redhat.com>
c3d added a commit to c3d/kata-containers that referenced this issue May 5, 2022
Many APIs now require an additional "context" argument that was not there in the
code that was reverted.

Fixes: kata-containers#722

Signed-off-by: Christophe de Dinechin <dinechin@redhat.com>
c3d added a commit to c3d/kata-containers that referenced this issue May 5, 2022
This is a first step towards restoring command-line subcommands for podman.
In this step, we restore the distinction between stateful sandboxes (shimv2)
and stateless ones (podman).

This is based on a revert of commit 3cf8b47.

Fixes: kata-containers#722

Signed-off-by: Christophe de Dinechin <dinechin@redhat.com>
c3d added a commit to c3d/kata-containers that referenced this issue May 5, 2022
This restores the various subcommands required to run kata containers from
within podman. This appears necessary since in the one year since we removed the
subcommands, no real progress has been made in podman towards using shimv2. If
anything, they now seem to be somewhat reluctant to doing it.

Since podman is quite useful and practical for local testing, it may be easier
to restore and maintain the code we had suppressed until podman actually moves
towards using shimv2, if that ever happens.

This is based on reverting "runtime: delete unused sub-commands"
from commit 069505e.

Fixes: kata-containers#722

Signed-off-by: Christophe de Dinechin <dinechin@redhat.com>
c3d added a commit to c3d/kata-containers that referenced this issue May 5, 2022
This applies the same kind of changes that Peng Tao introduced in
5b15e9e to the newly restored interfaces.

Fixes: kata-containers#722

Signed-off-by: Christophe de Dinechin <dinechin@redhat.com>
c3d added a commit to c3d/kata-containers that referenced this issue May 5, 2022
These APIs are necessary in order to restore the runtime subcommands required in
order to support podman.

This is primarily a revert of
"API: remove ProcessListContainer/ListProcesses"
commit 421439c.

Fixes: kata-containers#722

Signed-off-by: Christophe de Dinechin <dinechin@redhat.com>
c3d added a commit to c3d/kata-containers that referenced this issue May 5, 2022
These were removed in cleanup commit f607641
They are required for the `delete` command.

Fixes: kata-containers#722

Signed-off-by: Christophe de Dinechin <dinechin@redhat.com>
c3d added a commit to c3d/kata-containers that referenced this issue May 5, 2022
This was removed in cleanup commit 74192d1
but is needed for function `isCgroupMounted` in `oci.go`.

Fixes: kata-containers#722

Signed-off-by: Christophe de Dinechin <dinechin@redhat.com>
c3d added a commit to c3d/kata-containers that referenced this issue May 5, 2022
This is mostly a revert of "cli: delete not used files"
commit ff2b9e5.
The function is needed in `oci.go` in the `setupConsole` function.

Fixes: kata-containers#722

Signed-off-by: Christophe de Dinechin <dinechin@redhat.com>
c3d added a commit to c3d/kata-containers that referenced this issue May 5, 2022
Like the APIs that we restored, the commands themselves also need to be migrated
to the new tracing API.

Fixes: kata-containers#722

Signed-off-by: Christophe de Dinechin <dinechin@redhat.com>
c3d added a commit to c3d/kata-containers that referenced this issue May 5, 2022
Transform message from:

    Could not create the sandbox cgroup cgroups: cgroup mountpoint does not exist

into:

    Could not create the sandbox cgroup: cgroups: cgroup mountpoint does not exist

Fixes: kata-containers#722

Signed-off-by: Christophe de Dinechin <dinechin@redhat.com>
@adrecord
Copy link

adrecord commented Sep 9, 2022

Is this still being worked on? Thanks

@c3d
Copy link
Member

c3d commented Mar 9, 2023

@adrecord I am restarting an effort in that direction. See following comments.

@c3d
Copy link
Member

c3d commented Mar 9, 2023

There are currently four approaches that have been or are being considered:

  1. An "OCI multiplexer" that would act as a gateway between standard OCI command line and the shimv2 interface.
  2. A shared library written in C that podman could invoke in the same way they invoke libkrun.
  3. Adding support for the command-line to runtime-rs
  4. Adding support to the command-line back to the runtime.

@c3d
Copy link
Member

c3d commented Mar 9, 2023

Approaches being considered

OCI multiplexer

The OCI multiplexer approach is intended to be totally independent of either podman or Kata. It takes OCI command-line options as input, and convers them to the shimv2 interface.

The good news is that there is a crate for parsing OCI comand line options, as well as to connect to the shimv2 interface.

This approach should not need all the complexity of persisting / restoring the state that we used to have in the old days in Kata Runtime, because the state is in the shim. As long as we can connect to the sim, we should be OK.

Shared library

The podman team was successful calling linkrun that way. See discussion on podman for details. One benefit is that there is one less process, and that some of the required infrastructure is already in podman.

On the other hand, calling ttrpc from C means going through something like protobuf-c. Some quick experiments showed that parsing the required proto files leads to an annoyingly long list of -I options (there is no obvious way to interface with go module dependency management), but it is otherwise doable.

Command-line support in runtime-rs

Long-term, it might be nice to use liboci-cli directly and integrate that into runtime-rs, making it an OCI-compliant runtime again. This approach has two drawbacks:

  • It might bloat runtime-rs with features that are only useful from something like podman
  • It does not apply to the Go version of the runtime, so it's at best for the long-term.

However, the overhead might be relatively small and worth it to avoid having a separate process.

Command-line support in the Go runtime

The related branch has not been maintained or rebased in an eternity (or more). That approach is seen as going in the wrong direction by the architecture committee. It won't work for runtime-rs either. So let's drop it.

Other considerations

For the split host/tenant API, we need "something" that can sequence RPC commands that need both a host and a guest side, notably for networking setup. While ultimately that split and sequencing can only occur on a machine that the tenant owns (e.g. the laptop used to connect to the cluster) for obvious security reasons, in the shorter term, an intermediate wrapper could be used as a development tool to dispatch commands easily between host runtime and agent.

Conclusion

Currently focusing on the OCI multiplexer first approach.

@struanb
Copy link

struanb commented Jul 19, 2023

Due to issues like this one, experienced using Docker to launch Kata Containers, we built RunCVM (Run Container VM): an experimental open-source Docker container runtime, for launching standard container workloads in VMs.

Please note that RunCVM is not a direct competitor to Kata: as an experimental runtime, RunCVM cannot offer the same levels of stability and support as Kata. However RunCVM may be suitable for some use cases and is compatible with docker run today (with experimental support for podman run). Like Kata v2, RunCVM is also virtiofs-based for speed. RunCVM has minimal system dependencies: it relies on the Linux KVM module, and can even be installed in a GitHub Codespace.

I'm sharing this info here in case it's helpful to anyone who, like us, needs VM isolation for their container workloads, needs a virtiofs-based solution (ruling out Kata v1) and needs compatibility with docker run (ruling out Kata v2).

@neersighted
Copy link

It's worth noting that since Docker 23.0, Kata Containers v2 is natively supported. Could we remove Docker from the title and clarify that this is really only necessary for Podman in the issue body?

@amshinde amshinde changed the title re-add OCI CLI commands for docker/podman re-add OCI CLI commands for podman (Note: docker is now supported with docker-23.0) Oct 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/cli Command Line Interface (flags/options and arguments) enhancement Improvement to an existing feature kata-2.0-features Features introduced in Kata 2.0
Projects
Issue backlog
  
To do
Development

No branches or pull requests

9 participants