{"id":1149,"date":"2022-06-21T13:40:13","date_gmt":"2022-06-21T05:40:13","guid":{"rendered":"https:\/\/www.linuxdevops.cn\/?p=1149"},"modified":"2023-04-07T09:55:19","modified_gmt":"2023-04-07T01:55:19","slug":"k8s-ingress-nginx-add-custom-segment-error","status":"publish","type":"post","link":"https:\/\/www.linuxdevops.cn\/2022\/06\/k8s-ingress-nginx-add-custom-segment-error\/","title":{"rendered":"K8s Ingress-nginx \u6dfb\u52a0\u81ea\u5b9a\u4e49\u7247\u6bb5\u62a5\u9519"},"content":{"rendered":"
\u5728ingress \u4e2d\u6dfb\u52a0\u81ea\u5b9a\u4e49\u7247\u6bb5nginx.ingress.kubernetes.io\/server-snippet<\/strong> \u62a5\u9519 admission webhook "validate.nginx.ingress.kubernetes.io" denied the request: nginx.ingress.kubernetes.io\/server-snippet annotation cannot be used. Snippet directives are disabled by the Ingress administrator<\/em><\/p>\n \u539f\u56e0\uff1a<\/p>\n \u662f\u56e0\u4e3a\u5728ingress-nginx\u4e2d\u53d1\u73b0\u4e86\u4e00\u4e2a\u5b89\u5168\u95ee\u9898\u3002\u5177\u4f53\u53ef\u4ee5\u53c2\u8003 https:\/\/github.com\/kubernetes\/ingress-nginx\/issues\/7837<\/a> <\/p>\n \u786e\u8ba4\u98ce\u9669\u540e \u53ef\u4ee5\u4fee\u6539 nginx-ingress-controller\u5b9e\u4f8b\u7684configmap: nginx-ingress-nginx-controller\u7684 allow-snippet-annotations: \u201ctrue\u201d <\/strong><\/p>\n \u4fee\u6539\u5b8c\u6210\u4e4b\u540e\u5c31\u53ef\u4ee5\u6dfb\u52a0\u81ea\u5b9a\u4e49\u7247\u6bb5\u6ce8\u89e3\u4e86\u3002<\/p>\n","protected":false},"excerpt":{"rendered":" \u5728ingress \u4e2d\u6dfb\u52a0\u81ea\u5b9a\u4e49\u7247\u6bb5nginx.ingress.kubernetes.io\/server-sni<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[34],"tags":[111],"yoast_head":"\nnginx.ingress.kubernetes.io\/server-snippet: |\n if ( $request_uri ~* (\/doc.html|\/swagger)) {\n return 403;\n }<\/code><\/pre>\n