# 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`
- **Domain:** kubernetes
- **Category:** config_error
- **Verification:** ai_generated
- **Fix Rate:** 90%

## Root Cause

An annotation used in the Ingress resource is not recognized or supported by the configured ingress controller (e.g., Nginx Ingress Controller).

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| kubernetes 1.27 | active | — | — |
| nginx-ingress 1.8 | active | — | — |
| nginx-ingress 1.9 | active | — | — |

## Workarounds

1. **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"`.** (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"`.
   ```
2. **Edit the Ingress YAML and delete the invalid annotation line(s). Then reapply: `kubectl apply -f ingress.yaml`.** (85% success)
   ```
   Edit the Ingress YAML and delete the invalid annotation line(s). Then reapply: `kubectl apply -f ingress.yaml`.
   ```

## Dead Ends

- **** — Additional invalid annotations will only cause more validation errors, not fix the original one. (95% fail)
- **** — The annotation is validated at resource creation time by the API server, not by the controller at runtime. (90% fail)
- **** — Guessing annotation names often leads to typos or unsupported keys, causing the same error. (70% fail)
