Skip to content

Support portforward for kata and gVisor #6638

@Random-Liu

Description

@Random-Liu

We recently added portforward support for windows https://github.com/containerd/cri/blob/master/pkg/server/sandbox_portforward_windows.go. It exec into the pause container, and runs wincat.exe to do the bidirectional data redirection.

We can generalize the solution, and use it to support kata and gVisor, and even replace the current runc support to get rid of the dependency of socat on the host.

Option 1: Keep the socat implementation for runc, and support this for kata or gVisor.

We need to introduce 2 options PortforwardExecCmd and SandboxImage into runtime config https://github.com/containerd/cri/blob/master/pkg/config/config.go#L31.

And the CRI plugin will exec to run the PortforwardExecCmd instead of running socat if the 2 options above are configured for a runtime.

Option 2: Use this approach for everything.

This one requires changing the default sandbox image.

We are using k8s.gcr.io/pause:3.1 right now.

We need to:

  1. Either maintain our own pause image;
  2. Or work with Kubernetes upstream to add a socat implementation into the pause image.

Moving socat implementation into the pause image will get rid of the socat dependency for all Kubernetes users, and make it possible to support kata and gVisor, and windows is already doing that. I think it is worth doing.

NOTE that was previously discussed in https://docs.google.com/presentation/d/1x1B2_DFZ9VI2E_-pB2pzeYKtUxrK4XLXd7I0JWD1Z40/edit#slide=id.p.

One useful discussion there about this approach:

This makes the pause image larger, and increase the memory footprint when portforward runs.

However, pause image is only pulled once, and all pause containers share the same image, I don't see it introduce too much overhead.

As for memory footprint, if user doesn't use portforward, they won't be affected. If they are, the overall memory foot print is no difference with today, the extra memory usage is just moved into the pause container. The good thing is that the extra memory usage will be charged now; the bad thing is that this destabilize the pause container.

One option is that we keep pause process with original oom score, and set higher oom score adj for other utility exec processes.

@fvoznika @egernst @gnawux

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions