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
Check out [Enforce Pod Security Standards with Namespace Labels](/docs/tasks/configure-pod-container/enforce-standards-namespace-labels) to see example usage.
85
90
91
+
## Workload resources and Pod templates
92
+
93
+
Pods are often created indirectly, by creating a [workload
94
+
object](https://kubernetes.io/docs/concepts/workloads/controllers/) such as a {{< glossary_tooltip
95
+
term_id="deployment" >}} or {{< glossary_tooltip term_id="job">}}. The workload object defines a
96
+
_Pod template_ and a {{< glossary_tooltip term_id="controller" text="controller" >}} for the
97
+
workload resource creates Pods based on that template. To help catch violations early, both the
98
+
audit and warning modes are applied to the workload resources. However, enforce mode is **not**
99
+
applied to workload resources, only to the resulting pod objects.
100
+
86
101
## Exemptions
87
102
88
103
You can define _exemptions_ from pod security enforcement in order allow the creation of pods that
89
104
would have otherwise been prohibited due to the policy associated with a given namespace.
Exemptions must be explicitly enumerated, and do not support indirection such as label or group
94
-
selectors. Requests meeting exemption criteria are _ignored_ by the Admission Controller (all
95
-
`enforce`, `audit` and `warn` behaviors), except to record an audit annotation. Exemption
96
-
dimensions include:
108
+
Exemptions must be explicitly enumerated. Requests meeting exemption criteria are _ignored_ by the
109
+
Admission Controller (all `enforce`, `audit` and `warn` behaviors are skipped). Exemption dimensions include:
97
110
98
111
- **Usernames:** requests from users with an exempt authenticated (or impersonated) username are
99
112
ignored.
100
-
- **RuntimeClassNames:** pods and templated pods specifying an exempt runtime class name are
113
+
- **RuntimeClassNames:** pods and [workload resources](#workload-resources-and-pod-templates) specifying an exempt runtime class name are
101
114
ignored.
102
-
- **Namespaces:** pods and templated pods in an exempt namespace are ignored.
115
+
- **Namespaces:** pods and [workload resources](#workload-resources-and-pod-templates) in an exempt namespace are ignored.
116
+
117
+
{{< caution >}}
103
118
104
-
The username exemption is special in that the creating user is not persisted on the Pod object,
105
-
and the Pod may be modified by different non-exempt users in the future. Use cases for username
106
-
exemptions include:
119
+
Most pods are created by a controller in response to a [workload
120
+
resource](#workload-resources-and-pod-templates), meaning that exempting an end user will only
121
+
exempt them from enforcement when creating pods directly, but not when creating a workload resource.
122
+
Controller service accounts (such as `system:serviceaccount:kube-system:replicaset-controller`)
123
+
should generally not be exempted, as doing so would implicitly exempt any user that can create the
124
+
corresponding workload resource.
107
125
108
-
- Trusted {{< glossary_tooltip term_id="controller" text="controllers" >}} that create pods.
109
-
- Usernames that represent break-glass operations roles, for example for debugging workloads
110
-
in a namespace that has restrictions configured. This mechanism only works with a username
111
-
match; you cannot grant exemptions based on group membership.
126
+
{{< /caution >}}
112
127
113
-
Updates to the following pod fields are exempt from policy checks, meaning that if a pod update request only changes these fields, it will not be denied even if the pod is in violation of the current policy level:
128
+
Updates to the following pod fields are exempt from policy checks, meaning that if a pod update
129
+
request only changes these fields, it will not be denied even if the pod is in violation of the
130
+
current policy level:
114
131
115
-
- Any metadata updates EXCEPT changes to the seccomp or apparmor annotations:
132
+
- Any metadata updates **except** changes to the seccomp or AppArmor annotations:
- [Enforcing Pod Security Standards](/docs/setup/best-practices/enforcing-pod-security-standards)
127
143
- [Enforce Pod Security Standards by Configuring the Built-in Admission Controller](/docs/tasks/configure-pod-container/enforce-standards-admission-controller)
128
144
- [Enforce Pod Security Standards with Namespace Labels](/docs/tasks/configure-pod-container/enforce-standards-namespace-labels)
129
-
- [Migrating from PodSecurityPolicy to PodSecurity](/docs/tasks/secure-pods/migrate-from-psp)
145
+
- [Migrating from PodSecurityPolicy to PodSecurity](/docs/tasks/secure-pods/migrate-from-psp)
0 commit comments