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

rootless: use fuse-overlayfs snapshotter by default #2278

Merged
merged 1 commit into from
May 28, 2021

Conversation

AkihiroSuda
Copy link
Member

@AkihiroSuda AkihiroSuda commented May 25, 2021

kind v0.11 uses overlayfs containerd snapshotter for rootless, but rootless overlayfs has very complex requirement:

(debian kernel && modprobe opton permit_mounts_in_userns==1) || (ubuntu kernel) || (kernel >= 5.11 && !selinux)

And yet Debian variant is known to be broken (while Ubuntu variant is not): moby/moby#42302

OTOH, fuse-overlayfs just requires kernel >= 4.18.

The snapshotter can be still rolled back to overlayfs by setting KIND_EXPERIMENTAL_CONTAINERD_SNAPSHOTTER=overlayfs.

Close #2275


Node image: akihirosuda/tmp-kind-node:g42e6ce83-v1.21.1

The snapshotter can be overridden with `$KIND_EXPERIMENTAL_CONTAINERD_SNAPSHOTTER`.
e.g., `KIND_EXPERIMENTAL_CONTAINERD_SNAPSHOTTER=overlayfs`.

Close 2275

Signed-off-by: Akihiro Suda <[email protected]>
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label May 25, 2021
@k8s-ci-robot
Copy link
Contributor

Hi @AkihiroSuda. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot requested review from amwat and aojea May 25, 2021 06:32
@k8s-ci-robot k8s-ci-robot added the area/provider/podman Issues or PRs related to podman label May 25, 2021
@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label May 25, 2021
@AkihiroSuda AkihiroSuda reopened this May 25, 2021
@AkihiroSuda AkihiroSuda reopened this May 25, 2021
@AkihiroSuda
Copy link
Member Author

CI failure is unrelated

URL: ["https://vagrantcloud.com/fedora/33-cloud-base"]
Error: The requested URL returned error: 403

@AkihiroSuda AkihiroSuda reopened this May 25, 2021
@aojea
Copy link
Contributor

aojea commented May 25, 2021

CI failure is unrelated

URL: ["https://vagrantcloud.com/fedora/33-cloud-base"]
Error: The requested URL returned error: 403

oh,you already detected it

# Configure containerd-fuse-overlayfs snapshotter binary from upstream
ARG CONTAINERD_FUSE_OVERLAYFS_VERSION="1.0.2"
ARG CONTAINERD_FUSE_OVERLAYFS_TARBALL="v${CONTAINERD_FUSE_OVERLAYFS_VERSION}/containerd-fuse-overlayfs-${CONTAINERD_FUSE_OVERLAYFS_VERSION}-linux-${TARGETARCH}.tar.gz"
ARG CONTAINERD_FUSE_OVERLAYFS_URL="https://github.com/containerd/fuse-overlayfs-snapshotter/releases/download/${CONTAINERD_FUSE_OVERLAYFS_TARBALL}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this eventually be merged in? It seems like this is crucial enough to bake in 🤔

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, the containerd/containerd repo does not accept a new built-in snapshotter.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If having a separate binary is not comfortable, maybe we can consider patching kind-ci/containerd-nightlies. (Just adding import _ "github.com/containerd/fuse-overlayfs-snapshotter/plugin" line)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, the containerd/containerd repo does not accept a new built-in snapshotter.

That seems unfortunate, especially with it being essentially required for rootless. I hope they may reconsider for this case.

If having a separate binary is not comfortable, maybe we can consider patching kind-ci/containerd-nightlies. (Just adding import _ "github.com/containerd/fuse-overlayfs-snapshotter/plugin" line)

We probably don't want to patch containerd sources, but maybe worth considering if we can do it with our own stub source importing or something.

Users building images for compliance (e.g. EKS AIUI) will still need to update their builds to fix this though. It's less that we need to add a binary to the image and more that there's another unverified binary they may need to notice and start overriding + building. If we keep doing that it makes updating kind a riskier proposition.

It's also a little annoying to need to run more services though / extra entrypoint complexity though and I imagine the binary size is smaller when merged in. But it is not a deal breaker. It's still more important to make sure kind works.

@@ -243,6 +243,11 @@ func runArgsForNode(node *config.Node, clusterIPFamily config.ClusterIPFamily, n
"--volume", "/var",
// some k8s things want to read /lib/modules
"--volume", "/lib/modules:/lib/modules:ro",
// propagate KIND_EXPERIMENTAL_CONTAINERD_SNAPSHOTTER to the entrypoint script
"-e", "KIND_EXPERIMENTAL_CONTAINERD_SNAPSHOTTER",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any reason to not just enable this when rootless and forget the env?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This env var is for users who want to opt-in to KIND_EXPERIMENTAL_CONTAINERD_SNAPSHOTTER=overlayfs (kernel-mode real overlayfs) for better performance.
This env var is not needed for most users.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, hopefully in the future there some way we can check if real overlayfs is viable and automate selection.

// propagate KIND_EXPERIMENTAL_CONTAINERD_SNAPSHOTTER to the entrypoint script
"-e", "KIND_EXPERIMENTAL_CONTAINERD_SNAPSHOTTER",
// enable /dev/fuse explicitly for fuse-overlayfs
// (Rootless Podman does not automatically mount /dev/fuse with --privileged)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the reason for that? I'm only familiar with the rough concept of fuse 😅

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because fuse-overlayfs needs /dev/fuse to mount FUSE.

Copy link
Member

@BenTheElder BenTheElder May 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because fuse-overlayfs needs /dev/fuse to mount FUSE.

Sorry, that part I get, what I meant was: What's the reason for (the comment):

Rootless Podman does not automatically mount /dev/fuse with --privileged

Why this deviation?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kinda bug / TODO (of runc) due to complexity

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it sounds like they don't because it may not be present see e.g. openshift/enhancements#362

@BenTheElder
Copy link
Member

btw I'd be happy to sponsor your kubernetes organization membership, which would remove the needs-ok-to-test from all future PRs immediately, if nothing else 😅

@BenTheElder BenTheElder self-assigned this May 27, 2021
@BenTheElder
Copy link
Member

/ok-to-test

https://github.com/kubernetes/community/blob/master/community-membership.md#member

I'm sure @aojea would be happy to be a second sponsor

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels May 27, 2021
@aojea
Copy link
Contributor

aojea commented May 27, 2021

I'm sure @aojea would be happy to be a second sponsor

yep, absolutely

@AkihiroSuda
Copy link
Member Author

Thanks, opened a request in kubernetes/org#2740

I should have requested this a few years ago... 😅

@BenTheElder
Copy link
Member

#2287 we're going to cut a release with the runc update / CVE patch, but after that's done I intend to update the base image and move forward with this PR. thank you for your patience.

Copy link
Member

@BenTheElder BenTheElder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 28, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: AkihiroSuda, BenTheElder

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 28, 2021
@BenTheElder BenTheElder merged commit 0d37803 into kubernetes-sigs:main May 28, 2021
@BenTheElder BenTheElder mentioned this pull request May 28, 2021
"-e", "KIND_EXPERIMENTAL_CONTAINERD_SNAPSHOTTER",
// enable /dev/fuse explicitly for fuse-overlayfs
// (Rootless Docker does not automatically mount /dev/fuse with --privileged)
"--device", "/dev/fuse",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what if fuse isn't enabled / mounted?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/provider/docker Issues or PRs related to docker area/provider/podman Issues or PRs related to podman cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

rootless: use fuse-overlayfs by default
4 participants