kubernetes
config_error
ai_generated
true
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%Fix Rate
86%Confidence
1Evidence
2024-02-14First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| kubernetes 1.27 | active | — | — | — |
| nginx-ingress 1.8 | active | — | — | — |
| nginx-ingress 1.9 | active | — | — | — |
Root Cause
An annotation used in the Ingress resource is not recognized or supported by the configured ingress controller (e.g., Nginx Ingress Controller).
generic中文
Ingress 资源中使用的注解不被配置的 Ingress 控制器(例如 Nginx Ingress Controller)识别或支持。
Official Documentation
https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/annotations/Workarounds
-
95% success Check the official annotation list for Nginx Ingress Controller at https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/annotations/. For example, correct `nginx.ingress.kubernetes.io/rewrite-target` to `nginx.ingress.kubernetes.io/rewrite-target` (if misspelled) or use a supported annotation like `nginx.ingress.kubernetes.io/ssl-redirect: "true"`.
Check the official annotation list for Nginx Ingress Controller at https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/annotations/. For example, correct `nginx.ingress.kubernetes.io/rewrite-target` to `nginx.ingress.kubernetes.io/rewrite-target` (if misspelled) or use a supported annotation like `nginx.ingress.kubernetes.io/ssl-redirect: "true"`.
-
85% success Edit the Ingress YAML and delete the invalid annotation line(s). Then reapply: `kubectl apply -f ingress.yaml`.
Edit the Ingress YAML and delete the invalid annotation line(s). Then reapply: `kubectl apply -f ingress.yaml`.
中文步骤
在 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`。
Dead Ends
Common approaches that don't work:
-
95% fail
Additional invalid annotations will only cause more validation errors, not fix the original one.
-
90% fail
The annotation is validated at resource creation time by the API server, not by the controller at runtime.
-
70% fail
Guessing annotation names often leads to typos or unsupported keys, causing the same error.