-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
containerd: Enable enable_unprivileged_ports and enable_unprivileged_icmp by default #2748
Conversation
|
Welcome @olljanat! |
Hi @olljanat. 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 Once the patch is verified, the new status will be reflected by the 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. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: olljanat The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Hmm, I don't know that we should be enabling non-default containerd settings that aren't strictly necessary or documented as part of https://kubernetes.io/docs/setup/production-environment/container-runtimes/ I appreciate the desire to have these settings enabled, but doing so only in kind makes kind an inaccurate way to test applications. I would like to see this enabled, but not so much as a special case in KIND only. AFAICT kubernetes/kubernetes#102612 did not reach consensus to enable it. containerd/containerd#6170 certainly did not.
As you noted these settings can be enabled in your own clusters without being enabled by default by using a containerd config patch (which we need to document under https://kind.sigs.k8s.io/docs/user/configuration/, an example is in https://kind.sigs.k8s.io/docs/user/local-registry/).
ICMP is generally not enabled by Kubernetes's networking stack like TCP and UDP are. |
Some containerd developers was worry about some possible corner cases / unknown unknowns which might came with this one. I assumed that kind would be good place to try find those so they can be fixed. FYI. I have same proposal open also on k3s side k3s-io/k3s#5538 |
Our first and foremost goal still is testing Kubernetes itself https://kind.sigs.k8s.io/docs/contributing/project-scope/ I think edge cases could be discovered by using containerdConfigPAtches to turn it on and explore for those cases, but I don't think we should find them by turning it on and waiting for users to complain. Instead we're more likely to have users complain that they tested their application in kind but then it didn't work on their "real" cluster since there's currently no plan to roll this out in containerd by default or in any of the major vendors, and we try to avoid that. See e.g. #1331
ACK, but K3s is very clearly a forked subset of Kubernetes, as a general rule we're not inclined to follow that project. |
Ok. I noticed that containerd has added 2.0 milestone so opened this one now containerd/containerd#6924 However it comes to details What you mean by saying:
That ping test case works fine before dropping all capabilities so I would assume that ICMP need to be enabled at least on some level. EDIT: that looks to be busybox issue. Top of this change there need to be proper ping package installed on container like mentioned on https://serverfault.com/a/1001312 |
does |
@aojea containerd run PR validations also against of rootless. On rootless What comes to |
I prefer to not enable non-defaults options too, we already have a lot of exposure surface and we don't know the fallout ... people can always patch it in kind for their use cases... |
as of yet there is no response to containerd/containerd#6924 containerd/containerd#6170 (comment), I'd be curious to see those responses, but in the current state I think we should stick to: kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
name: test
containerdConfigPatches:
- |-
[plugins."io.containerd.grpc.v1.cri"]
enable_unprivileged_ports = true
enable_unprivileged_icmp = true |
@BenTheElder btw I wonder that has there been yet any discussion about Kubernetes 2.0 and collecting requirements for it? There is so many of those "secure by default" changes which would be needed that perhaps it would make sense to agree that new major version is needed to be able to include those breaking changes and that those need to live side by side quite long time? I'm thinking changes like that pods should run as non-root, without capabilities and using read only root filesystem by default unless user specify other why. |
I don't think there's currently any particularly serious discussion.
I think it would be difficult to reach agreement on to be honest, there's usually a lot of pushback against any breaking changes, they do happen though. Which is why I don't think there's any major 2.0 discussion happening, most users want less breakage and more portability, AFAICT. |
Proposed Changes
Make using hardened containers a bit easier by:
Types of Changes
Containerd configuration change. Those settings was added on containerd 1.6.x version.
Verification
Deploy following test service:
Check that NGINX is running and listening port 80
On theory also ping with command like:
kubectl exec -it test-... -- ping 1.1.1.1
should works but at least on my env it does not.
However at least sysctl setting
net.ipv4.ping_group_range
got value value0 2147483647
as expected. It might be configuration issue on my env or to be related the fact that kind run inside of docker.Change can be tested without building kind with configuration like this: