You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In this configuration, it just specifies`runAsUser`, `runAsGroup` and `supplementalGroups`.
169
+
This Pod security context contains`runAsUser`, `runAsGroup` and `supplementalGroups`.
170
170
However, you can see that the actual supplementary groups attached to the container process
171
171
will include group IDs which come from `/etc/group` in the container image.
172
172
@@ -200,7 +200,9 @@ The output is similar to this:
200
200
uid=1000 gid=3000 groups=3000,4000,50000
201
201
```
202
202
203
-
You can see `groups` includes group ID `50000`. This is because the user (`uid=1000`), which is defined in the image, belongs to the group (`gid=50000`), which is defined in `/etc/group` inside the container image.
203
+
You can see that `groups` includes group ID `50000`. This is because the user (`uid=1000`),
204
+
which is defined in the image, belongs to the group (`gid=50000`), which is defined in `/etc/group`
205
+
inside the container image.
204
206
205
207
Check the `/etc/group` in the container image:
206
208
@@ -223,7 +225,7 @@ exit
223
225
```
224
226
225
227
{{<note>}}
226
-
Implicitly _merged_ supplementary groups may cause security concerns particularly in accessing
228
+
_Implicitly merged_ supplementary groups may cause security problems particularly when accessing
227
229
the volumes (see [kubernetes/kubernetes#112879](https://issue.k8s.io/112879) for details).
228
230
If you want to avoid this. Please see the below section.
229
231
{{</note>}}
@@ -236,19 +238,25 @@ This feature can be enabled by setting the `SupplementalGroupsPolicy`
236
238
[feature gate](/docs/reference/command-line-tools-reference/feature-gates/) for kubelet and
237
239
kube-apiserver, and setting the `.spec.securityContext.supplementalGroupsPolicy` field for a pod.
238
240
239
-
**supplementalGroupsPolicy** - `supplementalGroupsPolicy` defines behavior for calculating
240
-
supplementary groups for the container processes in a pod.
241
+
The `supplementalGroupsPolicy` field defines the policy for calculating the
242
+
supplementary groups for the container processes in a pod. There are two valid
243
+
values for this field:
241
244
242
-
*_Merge_: The group membership defined in `/etc/group` for the container's primary user will be merged. If not specified, this policy will be applied.
245
+
*`Merge`: The group membership defined in `/etc/group` for the container's primary user will be merged.
246
+
This is the default policy if not specified.
243
247
244
-
*_Strict_: it only attaches group IDs in `fsGroup`, `supplementalGroups`, or `runAsGroup` fields as the supplementary groups of the container processess. This means no group membership defined in `/etc/group` for the container's primary user will be merged.
248
+
*`Strict`: Only group IDs in `fsGroup`, `supplementalGroups`, or `runAsGroup` fields
249
+
are attached as the supplementary groups of the container processes.
250
+
This means no group membership from `/etc/group` for the container's primary user will be merged.
245
251
246
-
When the feature is enabled, it also exposes the process identity attached to the first container process of the container
247
-
in `.status.containerStatuses[].user.linux` field. It would be helpful to detect if implicit group ID's are attached.
252
+
When the feature is enabled, it also exposes the process identity attached to the first container process
253
+
in `.status.containerStatuses[].user.linux` field. It would be useful for detecting if
This pod manifest defines `supplementalGroupsPolicy=Strict`. You can see no group membership defined in `/etc/group` will be merged to the supplementary groups for container processes.
258
+
This pod manifest defines `supplementalGroupsPolicy=Strict`. You can see that no group memberships
259
+
defined in `/etc/group` are merged to the supplementary groups for container processes.
252
260
253
261
Create the Pod:
254
262
@@ -280,7 +288,7 @@ See the Pod's status:
280
288
kubectl get pod security-context-demo -o yaml
281
289
```
282
290
283
-
You can see `status.containerStatuses[].user.linux` field exposes the process identitiy
291
+
You can see that the `status.containerStatuses[].user.linux` field exposes the process identitiy
284
292
attached to the first container process.
285
293
286
294
```none
@@ -299,9 +307,12 @@ status:
299
307
```
300
308
301
309
{{<note>}}
302
-
Please note that the values in `status.containerStatuses[].user.linux` field is _the firstly attached_
310
+
Please note that the values in the `status.containerStatuses[].user.linux` field is _the first attached_
303
311
process identity to the first container process in the container. If the container has sufficient privilege
304
-
to call system calls related to process identity (e.g. [`setuid(2)`](https://man7.org/linux/man-pages/man2/setuid.2.html), [`setgid(2)`](https://man7.org/linux/man-pages/man2/setgid.2.html) or [`setgroups(2)`](https://man7.org/linux/man-pages/man2/setgroups.2.html), etc.),
0 commit comments