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 차트를 사용 중이라면 다음과 같이 추가하면 됩니다.
controller:
config:
annotations-risk-level: Critical참고로 이번 변경은 보안 이슈에 대응하기 위해 이루어진 것입니다. 주로 멀티 테넌트 클러스터를 사용할 때 문제가 됩니다.
관련 이슈: https://github.com/kubernetes/ingress-nginx/issues/12618, https://github.com/kubernetes/kubernetes/issues/126811
글을 무작위로 읽기