@@ -149,7 +149,18 @@ The kubelet will pick host UIDs/GIDs a pod is mapped to, and will do so in a way
149
149
to guarantee that no two pods on the same node use the same mapping.
150
150
151
151
The `runAsUser`, `runAsGroup`, `fsGroup`, etc. fields in the `pod.spec` always
152
- refer to the user inside the container.
152
+ refer to the user inside the container. These users will be used for volume
153
+ mounts (specified in `pod.spec.volumes`) and therefore the host UID/GID will not
154
+ have any effect on writes/reads from volumes the pod can mount. In other words,
155
+ the inodes created/read in volumes mounted by the pod will be the same as if the
156
+ pod wasn't using user namespaces.
157
+
158
+ This way, a pod can easily enable and disable user namespaces (without affecting
159
+ its volume's file ownerships) and can also share volumes with pods without user
160
+ namespaces by just setting the appropriate users inside the container
161
+ (`RunAsUser`, `RunAsGroup`, `fsGroup`, etc.). This applies to any volume the pod
162
+ can mount, including `hostPath` (if the pod is allowed to mount `hostPath`
163
+ volumes).
153
164
154
165
The valid UIDs/GIDs when this feature is enabled is the range 0-65535. This
155
166
applies to files and processes (`runAsUser`, `runAsGroup`, etc.).
@@ -158,7 +169,17 @@ kubelet 将挑选 Pod 所映射的主机 UID/GID,
158
169
并以此保证同一节点上没有两个 Pod 使用相同的方式进行映射。
159
170
160
171
` pod.spec ` 中的 ` runAsUser ` 、` runAsGroup ` 、` fsGroup ` 等字段总是指的是容器内的用户。
161
- 启用该功能时,有效的 UID/GID 在 0-65535 范围内。这以限制适用于文件和进程(` runAsUser ` 、` runAsGroup ` 等)。
172
+ 这些用户将用于卷挂载(在 ` pod.spec.volumes ` 中指定),
173
+ 因此,主机上的 UID/GID 不会影响 Pod 挂载卷的读写操作。
174
+ 换句话说,由 Pod 挂载卷中创建或读取的 inode,将与 Pod 未使用用户命名空间时相同。
175
+
176
+ 通过这种方式,Pod 可以轻松启用或禁用用户命名空间(不会影响其卷中文件的所有权),
177
+ 并且可以通过在容器内部设置适当的用户(` runAsUser ` 、` runAsGroup ` 、` fsGroup ` 等),
178
+ 即可与没有用户命名空间的 Pod 共享卷。这一点适用于 Pod 可挂载的任何卷,
179
+ 包括 ` hostPath ` (前提是允许 Pod 挂载 ` hostPath ` 卷)。
180
+
181
+ 启用该功能时,有效的 UID/GID 在 0-65535 范围内。
182
+ 这适用于文件和进程(` runAsUser ` 、` runAsGroup ` 等)。
162
183
163
184
<!--
164
185
Files using a UID/GID outside this range will be seen as belonging to the
0 commit comments