-
Notifications
You must be signed in to change notification settings - Fork 374
[RFC] Implement a runtime interface v2 for both containerd and cri-o #907
Comments
Thanks @sboeuf for the figure and explanation. I pretty support the work on CRI-O support, however, I have some thoughts on the proposal. On the new indirect layerAt the well beginning, we implemented the runtime as both a command line tool and a library. As a result, we may have Then my questions (comments) are:
On the critiques against gRPCIn general, I don't think gRPC is the best interface for kata, but I don't think it is wrong. I definitely agree on that gRPC introduced some overhead on both latency and memory consumption. And I personally think that the implementation of containerd is a bit too sophisticated for new developers. However, I think the "spirit of decoupling every part" behind containerd is somehow correct. The gRPC here is introduced to decouple the daemon and runtime implementation, which implies it hide more detail of the runtime, it may be deployed distributedly or on a heterogeneous platform. |
@sboeuf @gnawux I think the most different part between the proposed WDYT? |
Ok so today I had a call with CRI-O folks that helped to clarify things a lot! The part that I misunderstood was that we were talking about a Go interface inside CRI-O itself, and we would provide a Kata Containers implementation for that. They're actually not opposed to host the implementation directly in CRI-O repository as it would simplify the testing (instead of having a shared library for that). Based on the fact that this implementation would be specific to Kata v2, then we could implement the gRPC client from there, which would simplify a lot here. This means that we could directly reuse the
I totally agree here. And if we think about things like live upgrade or high availability (handle crash and restart), it makes more sense to use the decoupling/abstraction that we could benefit from gRPC. Updated diagram
|
Just make it clear. The interface is a grpc interface, but the server is ttrpc server which is more light weight.
Agree. Thanks for pointing this out. :)
Sounds good. |
Thanks @Random-Liu for the comments :) @gnawux @bergwolf does the updated proposal make more sense? Basically, we agree on this, we could get started with the definition/implementation of the new interface in CRI-O, and it should work out the box with the pending implementation of |
The updated proposal looks good, and we're now more sure that |
Yes, we're not going to get rid of the Overall I think the direction this goes into makes perfect sense, but in the long run it would be quite beneficial to see a standardized RPC interface for container runtimes, proposed by/to the OCI. Something runc, CRI-O, containerd and all others could converge into. One final nit: On your v1 diagram, there should only be one |
Well I think latest Docker depends on latest containerd, so the support should be there. That being said, I hope Docker does not make any weird assumptions based on PIDs even when using containerd v2. I think @Random-Liu and @crosbymichael have more input on this. The only concern I have about removing support of the CLI at some point would be for some of our customers that might run with older versions of Docker, which would not rely on latest containerd.
Agreed! I really think that once we can show that we converged both CRI-O and containerd to this interface, we can push for this interface to become a standard one.
Oh yes that's right, the Go interface has to cover everything, which would simplify this diagram :) |
@sboeuf Many thanks for the clarification. It makes much more sense then. |
I can't agree more! There was once a PR trying to standardize runc CLI but failed, see Add Runtime CLI Spec , I was quite looking forward to it but sadly it seems making a CLI spec is too hard. Instead, GRPC interface could benifit non-runc OCI runtime a lot and easier to standardize.
@sboeuf |
I don't want to be a killjoy, but I personally really don't like the idea of using GRPC for everything. My primary issue with it is that it requires a long-running daemon for management, something which really shouldn't be necessary (IMHO) just to have sane calling conventions. I already am not a huge fan that But that's just me, and as someone who followed and commented on all of the OCI runtime-spec CLI discussions and I'm well aware how much of a battle that was. But if we're going to have a GRPC interface I would at least request that we standardise this (by which I mean "put it in OCI or similar", not "standardise within the k8s source tree") so it's actually generally usable outside of k8s. |
I understand the concerns here but that's also what's allows for a proper abstraction layer so that daemon's such as CRI-O and containerd can be restarted without tearing down some running pods and containers.
I couldn't agree more on this, here is one of my previous comment on this thread:
where @Random-Liu agreed it would be a good thing to have. Also, we've talked about this offline with @mrunalp, and we agreed a neutral place for this interface would be pretty more appropriate than the containerd repo. |
Forgive me -- I'm an utter, total outsider here (catching up on 2 1/2 years of convos and spec revisions), but... Please, don't make everything use gRPC. A CLI API is a known quantity; file descriptors and How about a nice generic websocket interface instead? [1] Or at least Protocol Buffers, the serialization format, plus HTTP 2, the network protocol, plus specific state handling, all of which are relatively standard in Go, but are more difficult (without library upon library) in other languages. |
Problem statement
Recently,
containerd
defined a new interface calledcontainerd-shim-v2
. The main goal for this new interface is to make sure that no assumption is based on the PID of the container processes. This way, it allows for a way better support of VM based container runtimes such as Kata Containers.We currently have a PR in flight to support this interface: #572
One thing to notice that will help to understand the problem statement is that
containerd-shim-v2
is a gRPC interface that expects the implementation to be defined through a gRPC server.The introduction of this new API is a real step forward in making VM based container runtimes first class citizens in the container ecosystem, and I think we're all excited about that.
However, I have one concern regarding the burden maintenance on the long term between different solutions out there. By that, I mean that I would expect that we could progressively lower the maintenance on the
kata-runtime
CLI, and eventually deprecate it since thecontainerd-shim-v2
interface is a better fit for VM based runtimes.Unfortunately, this logic does not work if all the players in the ecosystem don't rely on such interface, but instead stick to the
runc
CLI one. And here I'm thinking aboutCRI-O
, which is the other CRI implementation widely used to run Kata Containers.That's why we've started some discussion with
CRI-O
maintainers (/cc @runcom @mrunalp) in order to fill this gap and get a better support for VM based runtimes throughCRI-O
too.Difference between CRI-O and containerd
CRI-O
maintainers agree with the need for such interface and they are more than happy to move into this direction rather sooner than later.There's only one point where they would like something different than what has been introduced by
containerd
, thegRPC
server. Indeed, adding agRPC
protocol brings a clear abstraction layer, but it brings some memory footprint increase due to the extra process running one server per sandbox. Another argument mentioned was the complexity to debug issues when too manygRPC
layers are involved when looking at the full stack.Based on this, we don't want to diverge by implementing one interface for
CRI-O
and another forcontainerd
, otherwise we would get back to the initial problem of maintaining several code bases according to the interface being used.Proposal
That's why I thought we could try to define a standard interface, something that would not be specific to
containerd
orCRI-O
, but that both could rely on.From containerd perspective
containerd-shim-v2
interface would be a simplegRPC
wrapper on top of this new interface. This wrapper would be specific tocontainerd-shim-v2
, and would implement only thegRPC
server logic.From CRI-O perspective
CRI-O
would rely directly on this interface, and in order to avoid the usage of anyclient/sever
model, it would import this interface definition from a standard package, and it would use Kata Containers implementation as a shared library implementing this interface. Thiskata_runtime_api_v2.so
would be provided through theCRI-O
configuration file, and could be different depending on the chosen runtime (relying on RuntimeClass).More thoughts
This API needs to be defined carefully by making sure it receives the right information/parameters through every function call.
Moreover, I think this new API should assume being run by a long running process, this way the implementation can easily assume that it will be able to retrieve the pointers it needs, without recreating in-memory data from scratch (reading from disk basically).
An ASCII diagram to clarify :)
Here is a link to a google doc where we started this conversation and how we could achieve this.
Feedback? Questions?
/cc @egernst @sameo @mcastelino @amshinde @grahamwhaley @jodh-intel @bergwolf @lifupan @gnawux @WeiZhang555 @jon @mrunalp @runcom @crosbymichael @Random-Liu
The text was updated successfully, but these errors were encountered: