kubernetes
config_error
ai_generated
true
错误:Ingress.networking.k8s.io "my-ingress" 无效:metadata.annotations:无效值:"nginx.ingress.kubernetes.io/rewrite-target":必须是 Ingress 控制器的有效注解
Error: Ingress.networking.k8s.io "my-ingress" is invalid: metadata.annotations: Invalid value: "nginx.ingress.kubernetes.io/rewrite-target": must be a valid annotation for the ingress controller
ID: kubernetes/ingress-annotation-invalid
90%修复率
86%置信度
1证据数
2024-02-14首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| kubernetes 1.27 | active | — | — | — |
| nginx-ingress 1.8 | active | — | — | — |
| nginx-ingress 1.9 | active | — | — | — |
根因分析
Ingress 资源中使用的注解不被配置的 Ingress 控制器(例如 Nginx Ingress Controller)识别或支持。
English
An annotation used in the Ingress resource is not recognized or supported by the configured ingress controller (e.g., Nginx Ingress Controller).
官方文档
https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/annotations/解决方案
-
在 https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/annotations/ 查看 Nginx Ingress Controller 的官方注解列表。例如,将 `nginx.ingress.kubernetes.io/rewrite-target` 更正为正确的拼写,或使用支持的注解如 `nginx.ingress.kubernetes.io/ssl-redirect: "true"`。
-
编辑 Ingress YAML 并删除无效的注解行。然后重新应用:`kubectl apply -f ingress.yaml`。
无效尝试
常见但无效的做法:
-
95% 失败
Additional invalid annotations will only cause more validation errors, not fix the original one.
-
90% 失败
The annotation is validated at resource creation time by the API server, not by the controller at runtime.
-
70% 失败
Guessing annotation names often leads to typos or unsupported keys, causing the same error.