ingress-nginx の ConfigurationSnippet 検証を修正する
今日は 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)では、アノテーションがリスクに応じて分類されるようになったようです。表はこちらにあります。
現在は、ConfigMap に次の設定を指定する必要があります。
annotations-risk-level: CriticalHelm chart を使っている場合は、次のように追加できます。
controller:
config:
annotations-risk-level: Criticalこの変更は、セキュリティ上の問題への対応である点に注意してください。主にマルチテナントのクラスタを使っている場合に問題になります。
Issues: https://github.com/kubernetes/ingress-nginx/issues/12618, https://github.com/kubernetes/kubernetes/issues/126811
記事をランダムに読む