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
Copy file name to clipboardExpand all lines: content/en/blog/_posts/2024-04-01-validating-admission-policy-ga/index.md
+9-10Lines changed: 9 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,6 @@ We are excited to announce that Validating Admission Policy has reached its Gene
12
12
as part of Kubernetes 1.30 release. If you have not yet read about this new declarative alternative to
13
13
validating admission webhooks, it may be interesting to read our
14
14
[previous post](/blog/2022/12/20/validating-admission-policies-alpha/) about the new feature.
15
-
16
15
If you have already heard about Validating Admission Policy and you are eager to try it out, there is no better way to
17
16
start using it by replacing an existing webhook.
18
17
@@ -50,7 +49,7 @@ Check out [the doc](https://kubernetes.io/docs/reference/access-authn-authz/exte
50
49
for a refresher on how admission webhooks work. Or, see the [full code](https://gist.github.com/jiahuif/2653f2ce41fe6a2e5739ea7cd76b182b) of this webhook to follow along this tutorial.
51
50
52
51
# The Policy
53
-
Now let's try to recreate the validation with a ValidatingAdmissionPolicy.
52
+
Now let's try to recreate the validation faithfully with a ValidatingAdmissionPolicy.
message: 'all containers must set privileged to false'
113
+
message: 'all containers must NOT set privileged to true'
115
114
```
116
115
Check its status again, and you should see all warnings cleared.
117
116
@@ -163,8 +162,8 @@ EOF
163
162
```text
164
163
Warning: Validation failed for ValidatingAdmissionPolicy 'pod-security.policy.example.com' with binding 'pod-security.policy-binding.example.com': all containers must set runAsNonRoot to true
165
164
Warning: Validation failed for ValidatingAdmissionPolicy 'pod-security.policy.example.com' with binding 'pod-security.policy-binding.example.com': all containers must set readOnlyRootFilesystem to true
166
-
Warning: Validation failed for ValidatingAdmissionPolicy 'pod-security.policy.example.com' with binding 'pod-security.policy-binding.example.com': all containers must set allowPrivilegeEscalation to false
167
-
Warning: Validation failed for ValidatingAdmissionPolicy 'pod-security.policy.example.com' with binding 'pod-security.policy-binding.example.com': all containers must set privileged to false
165
+
Warning: Validation failed for ValidatingAdmissionPolicy 'pod-security.policy.example.com' with binding 'pod-security.policy-binding.example.com': all containers must NOT set allowPrivilegeEscalation to true
166
+
Warning: Validation failed for ValidatingAdmissionPolicy 'pod-security.policy.example.com' with binding 'pod-security.policy-binding.example.com': all containers must NOT set privileged to true
168
167
Error from server: error when creating "STDIN": admission webhook "webhook.example.com" denied the request: container "nginx" must set RunAsNonRoot to true in its SecurityContext
169
168
```
170
169
Not quite the exact same behavior but good enough. After a few other cases, when we are confident with our policy, maybe it is time for some refactoring.
0 commit comments