Skip to content

Commit ce90c28

Browse files
committed
userns: fixes from the review
Signed-off-by: Giuseppe Scrivano <[email protected]>
1 parent 72618fc commit ce90c28

File tree

1 file changed

+12
-79
lines changed

1 file changed

+12
-79
lines changed

keps/sig-node/127-user-namespaces/README.md

+12-79
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,13 @@
2222
- [Phases](#phases)
2323
- [Phase 1: pods &quot;without&quot; volumes](#phase-1-pods-without-volumes)
2424
- [Phase 2: pods with volumes](#phase-2-pods-with-volumes)
25-
- [Phase 3: pod to pod isolation](#phase-3-pod-to-pod-isolation)
25+
- [Phase 3: TBD](#phase-3-tbd)
2626
- [Summary of the Proposed Changes](#summary-of-the-proposed-changes)
2727
- [Test Plan](#test-plan)
2828
- [Graduation Criteria](#graduation-criteria)
29-
- [pod.spec.useHostUsers graduation](#podspecusehostusers-graduation)
3029
- [Alpha](#alpha)
3130
- [Beta](#beta)
3231
- [GA](#ga)
33-
- [pod.spec.securityContext.userns.pod2podIsolation graduation](#podspecsecuritycontextusernspod2podisolation-graduation)
34-
- [Alpha](#alpha-1)
35-
- [Beta](#beta-1)
36-
- [GA](#ga-1)
3732
- [Upgrade / Downgrade Strategy](#upgrade--downgrade-strategy)
3833
- [Version Skew Strategy](#version-skew-strategy)
3934
- [Production Readiness Review Questionnaire](#production-readiness-review-questionnaire)
@@ -72,8 +67,7 @@ Items marked with (R) are required *prior to targeting to a milestone / release*
7267
## Summary
7368

7469
This KEP adds a new `hostUsers` field to `pod.Spec` to allow to enable/disable
75-
using user namespaces for pods. Furthermore, it allows increased pod to pod
76-
isolation by means of `pod.spec.securityContext.userns.pod2podIsolation` field.
70+
using user namespaces for pods.
7771

7872
It allows users to place pods in different user namespaces increasing the
7973
pod-to-pod and pod-to-host isolation. This extra isolation increases the cluster
@@ -205,14 +199,11 @@ Note: Names are preliminary yet, I'm using field names to simplify explanations.
205199

206200
The following changes will be done to the pod.spec:
207201

208-
- `pod.spec.useHostUsers`: bool.
202+
- `pod.spec.hostUsers`: bool.
209203
If true or not present, uses the host user namespace (as today)
210204
If false, a new userns is created for the pod.
211205
This field will be used for phase 1, 2 and 3.
212-
213-
- `pod.spec.securityContext.userns.pod2podIsolation`: Enum
214-
If enabled, we will make the userns mappings be non-overlapping as much as possible.
215-
This field will be used in phase 3.
206+
By default it is set to `true`.
216207

217208
### Phases
218209

@@ -238,11 +229,9 @@ combination of the following volume types are used by the pod:
238229
This list of volumes was chosen as they can't be used to share files with other
239230
pods.
240231

241-
The mapping length will be 65535, mapping the range 0-65534 to the pod. This wide
242-
range makes sure most workloads will work fine.
243-
244-
The mapping will be chosen by the kubelet, using a simple algorithm to give
245-
different pods in this category ("without" volumes) a non-overlapping mapping.
232+
The mapping and the mapping length will be chosen by the kubelet,
233+
using a simple algorithm to give different pods in this category
234+
("without" volumes) a non-overlapping mapping.
246235
Giving non-overlapping mappings generates the best isolation for pods.
247236

248237
Furthermore, the node UID space of 2^32 can hold up to 2^16 pods each with a
@@ -267,56 +256,7 @@ listed vulnerabilities (as the host is protected from the container). It is also
267256
a trivial next-step to take, given that we have phase 1 implemented: just return
268257
the same mapping if the pod has other volumes.
269258

270-
#### Phase 3: pod to pod isolation
271-
272-
This phase will provide more isolation between pods that use volumes (as in
273-
phase 2) and requires another opt-in field:
274-
`pod.spec.securityContext.pod2podIsolation`.
275-
276-
This phase will try to not share the same mapping for all pods with volumes, as
277-
phase 2 does, but to achieve it some trade off needs to be made. This phase
278-
builds on the work of the previous phases and more details will be defined while
279-
the other phases evolve.
280-
281-
Here are some ideas so far:
282-
283-
One idea is to give different mappings to pods in different k8s namespaces or
284-
that use a different service account. This needs to be explored in further
285-
detail, but will probably impose limits to which workloads can run this (we need
286-
to expose a shorter mapping, less than 65535).
287-
288-
Another idea is to use id mapped mounts. This probably needs changes to the
289-
OCI runtime-spec, only works with certain filesystems and kernels that may take
290-
too long for some users to get (like managed services). Giuseppe started to
291-
experiment in crun with this
292-
[here](https://github.com/containers/crun/pull/780).
293-
294-
The value for `pod.spec.securityContext.pod2podIsolation` will be an enum, to
295-
select different strategies and allow room for future improvements.
296-
297-
It is being considered having a value that is "auto" for this fields, that
298-
will select the best strategy that your node supports. However, as different
299-
strategies will change the effective UID a container uses, if we add such an
300-
option the documentation will be VERY clear about the implications and
301-
automatizations will be provided whenever possible (we have some ideas on this
302-
front).
303-
304-
Another improvement suggested by @ddebroy to do here is:
305-
* Pods using also only [local ephemeral CSI volumes][csi-ephemeral-vol], as
306-
they share the same lifecycle of the pod, can be moved to use non-overlapping
307-
mappings.
308-
309-
This change can probably be done under the hood without the user noticing, to
310-
achieve more pod 2 pod isolation, and might not need the user to use
311-
`pod.spec.securityContext.pod2podIsolation`. However, some changes for the CSI
312-
vol to use the effective UID/GID might be needed and not trivial. @ddebroy has
313-
[kindly offered to help][csi-help] with this improvement
314-
315-
[csi-ephemeral-vol]: https://kubernetes-csi.github.io/docs/ephemeral-local-volumes.html#overview
316-
[csi-help]: https://github.com/kubernetes/enhancements/pull/3065/files#r762046107
317-
318-
If this phase turns out to be a lot of work, it will be left out as future work
319-
for other KEPs.
259+
#### Phase 3: TBD
320260

321261
### Summary of the Proposed Changes
322262

@@ -347,23 +287,16 @@ TBD
347287

348288
### Graduation Criteria
349289

350-
Graduation for each pod.spec field we introduce will be separate.
351-
352-
#### pod.spec.useHostUsers graduation
353-
354290
##### Alpha
355291

356292
##### Beta
357293

358294
##### GA
359295

360-
#### pod.spec.securityContext.userns.pod2podIsolation graduation
361-
362-
##### Alpha
363-
364-
##### Beta
365-
366-
##### GA
296+
- Make plans on whether, when, and how to enable by default
297+
- Should we reconsider making the mappings smaller by default?
298+
- Should we allow any way for users to for "more" IDs mapped? If yes, how many more and how?
299+
- Should we allow the user can ask for specific mappings?
367300

368301
### Upgrade / Downgrade Strategy
369302

0 commit comments

Comments
 (0)