Skip to content

Commit ae3745c

Browse files
committed
[2025-01-03] Update notes
1 parent 129d715 commit ae3745c

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
title: Fixing ingress-nginx ConfigurationSnippet validations
3+
date: 2025-01-03
4+
---
5+
Today I found myself needing to configure ingress-nginx. I needed to write a bit of nginx config to rewrite status codes for certain routes.
6+
7+
Something like
8+
9+
```yaml
10+
nginx.ingress.kubernetes.io/configuration-snippet: |-
11+
location /metrics {
12+
return 404;
13+
}
14+
15+
```
16+
17+
I've done this many times in the past, but today I received the following error
18+
19+
```
20+
Error: UPGRADE FAILED: cannot patch "xyz" with kind Ingress: admission webhook "validate.nginx.ingress.kubernetes.io" denied the request: annotation group ConfigurationSnippet contains risky annotation based on ingress configuration
21+
```
22+
23+
I already had
24+
25+
```yaml
26+
allowSnippetAnnotations: true
27+
```
28+
29+
set, so this was confusing!
30+
31+
It turns out, in a recent release (controller 1.12), annotations are flagged by risk. There's a table [here](https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/annotations-risk/)
32+
33+
You now need to specify
34+
35+
```yaml
36+
annotations-risk-level: Critical
37+
```
38+
39+
in the configmap. If you're using the helm chart, it can be added like so
40+
41+
```yaml
42+
controller:
43+
config:
44+
annotation-risk-level: Critical
45+
```
46+
47+
Note that this change is a reaction to a security issue. This is mostly an issue if you're using a multi-tenant cluster.
48+
49+
Issue: https://github.com/kubernetes/ingress-nginx/issues/12618

0 commit comments

Comments
 (0)