修復 ingress-nginx ConfigurationSnippet 驗證問題
原文由 Ellie Huxtable 于 發布,訂閱此部落格
今天我需要設定 ingress-nginx。我得寫一段 nginx 設定來改寫特定路由的狀態碼。
像是這樣
nginx.ingress.kubernetes.io/configuration-snippet: |-
location /metrics {
return 404;
}以前我已經這樣做過很多次了,但今天卻收到了以下錯誤
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我本來就已經設定了
allowSnippetAnnotations: true,所以這實在讓人困惑!
原來,在最近的版本(controller 1.12)中,annotations 會依風險等級被標記。相關表格在這裡
現在你必須指定
annotations-risk-level: Critical在 configmap 中。如果你是使用 Helm chart,可以這樣加入
controller:
config:
annotations-risk-level: Critical請注意,這項變更是為了回應安全性問題。如果你使用的是多租戶叢集,這個問題的影響才比較大。
相關 Issue:https://github.com/kubernetes/ingress-nginx/issues/12618, https://github.com/kubernetes/kubernetes/issues/126811
隨機一篇部落格
留言
登入後參與討論