Skip to content

Commit 1fe7ae2

Browse files
authored
Merge pull request #4084 from giuseppe/usernamespace-stateful-pods
KEP-127: add support for stateful pods
2 parents a7bfe21 + 819dae6 commit 1fe7ae2

File tree

1 file changed

+12
-28
lines changed

1 file changed

+12
-28
lines changed

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

Lines changed: 12 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# KEP-127: Support User Namespaces in stateless pods
1+
# KEP-127: Support User Namespaces
22

33
<!-- toc -->
44
- [Release Signoff Checklist](#release-signoff-checklist)
@@ -18,8 +18,8 @@
1818
- [Design Details](#design-details)
1919
- [Pod.spec changes](#podspec-changes)
2020
- [CRI changes](#cri-changes)
21-
- [Support for stateless pods](#support-for-stateless-pods)
22-
- [Handling of stateless volumes](#handling-of-stateless-volumes)
21+
- [Support for pods](#support-for-pods)
22+
- [Handling of volumes](#handling-of-volumes)
2323
- [Example of how idmap mounts work](#example-of-how-idmap-mounts-work)
2424
- [Example without idmap mounts](#example-without-idmap-mounts)
2525
- [Example with idmap mounts](#example-with-idmap-mounts)
@@ -75,7 +75,7 @@ Items marked with (R) are required *prior to targeting to a milestone / release*
7575

7676
## Summary
7777

78-
This KEP adds support to use user-namespaces in stateless pods.
78+
This KEP adds support to use user-namespaces.
7979

8080
## Motivation
8181

@@ -130,7 +130,6 @@ Here we use UIDs, but the same applies for GIDs.
130130
the pod (not valid in the host).
131131
- Benefit from the security hardening that user namespaces provide against some
132132
of the future unknown runtime and kernel vulnerabilities.
133-
- Support only stateless pods
134133

135134
### Non-Goals
136135

@@ -141,16 +140,15 @@ Here we use UIDs, but the same applies for GIDs.
141140
- Implement all the very nice use cases that user namespaces allows. The goal
142141
here is to allow them as incremental improvements, not implement all the
143142
possible ideas related with user namespaces.
144-
- Support stateful pods
145143

146144
[kubelet-userns]: https://github.com/kubernetes/enhancements/tree/master/keps/sig-node/2033-kubelet-in-userns-aka-rootless
147145

148146
## Proposal
149147

150148
This KEP adds a new `hostUsers` field to `pod.Spec` to allow to enable/disable
151-
using user namespaces for stateless pods.
149+
using user namespaces.
152150

153-
This proposal aims to support running stateless pods inside user namespaces.
151+
This proposal aims to support running pods inside user namespaces.
154152

155153
This mitigates all the vulnerabilities listed in the motivation section.
156154

@@ -288,20 +286,10 @@ message Mount {
288286
}
289287
```
290288

291-
### Support for stateless pods
289+
### Support for pods
292290

293-
Make pods "without" volumes work with user namespaces. This is activated via the
294-
bool `pod.spec.HostUsers` and can only be set to `false` on pods which use
295-
either no volumes or only volumes of the following types:
296-
297-
- configmap
298-
- secret
299-
- downwardAPI
300-
- emptyDir
301-
- projected
302-
303-
This list of volumes was chosen as they can't be used to share files with other
304-
pods.
291+
Make pods work with user namespaces. This is activated via the
292+
bool `pod.spec.HostUsers`.
305293

306294
The mapping length will be 65536, mapping the range 0-65535 to the pod. This wide
307295
range makes sure most workloads will work fine. Additionally, we don't need to
@@ -331,10 +319,7 @@ limit the number of pods using user namespaces to `min(maxPods, 1024)`. This
331319
leaves us plenty of host UID space free and this limits is probably never hit in
332320
practice. See UNRESOLVED for more some UNRESOLVED info we still have on this.
333321

334-
### Handling of stateless volumes
335-
336-
Only the aforementioned volume types are supported. If other volume types are
337-
used, a clear error is thrown during API validation of the pod.spec.
322+
### Handling of volumes
338323

339324
When the volumes used are supported, the kubelet will set the `uid_mappings` and
340325
`gid_mappings` in the CRI `Mount message`. It will use the same mappings the
@@ -919,7 +904,7 @@ kernels, but the SLO will be excluded in that case.
919904

920905
The SLO that might be affected is:
921906

922-
> Startup latency of schedulable stateless pods, excluding time to pull images and run init containers, measured from pod creation timestamp to when all its containers are reported as started and observed via watch, measured as 99th percentile over last 5 minutes
907+
> Startup latency of schedulable pods, excluding time to pull images and run init containers, measured from pod creation timestamp to when all its containers are reported as started and observed via watch, measured as 99th percentile over last 5 minutes
923908
924909
The rootfs needs to be accessible by the user in the user namespace the pod is.
925910
As every pod might run as a different user, we only know the mapping for a pod
@@ -1135,8 +1120,7 @@ mapping and have different runtimes pick different mappings. While KEP authors
11351120
disagree on this, we still need to discuss it and settle on something. This was
11361121
[raised here](https://github.com/kubernetes/enhancements/pull/3065#discussion_r798760382)
11371122

1138-
For stateless pods with 64k mappings this is not an issue. This was considered
1139-
something to discuss for pods with volumes (out of scope of this KEP).
1123+
This is not a blocker for the KEP, but it is something that can be changed later on.
11401124

11411125
<!--
11421126
What other approaches did you consider, and why did you rule them out? These do

0 commit comments

Comments
 (0)