Course contentsShow
← Cloud and Infrastructure
Lesson 1226 of 2,98924. Kubernetes NetworkingFree lesson

Ingress Annotations

Use controller-specific annotations to configure advanced behaviors like redirects, timeouts, and rewrites.

Ingress Annotations

What You'll Learn

You'll learn how to use controller-specific annotations to fine-tune your Ingress behavior with advanced features like redirects, timeouts, and URL rewrites.

The Core Idea

Ingress Annotations are metadata tags that let you customize how your Ingress controller handles traffic beyond what the standard Ingress spec supports. Think of them like post-it notes on a delivery package—they give special instructions to the delivery person (the Ingress controller) about how to handle that particular package.

While the basic Ingress resource defines what to route where, annotations tell the controller how to route it. Different controllers (NGINX, Traefik, HAProxy) support different annotations because each has unique capabilities.

Common Annotation Use Cases

URL Rewrites

Rewrite incoming paths before forwarding to backend services:

metadata:
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /

HTTP to HTTPS Redirects

Force all traffic to use HTTPS:

metadata:
  annotations:
    nginx.ingress.kubernetes.io/ssl-redirect: "true"

Timeouts

Adjust how long the controller waits for backend responses:

metadata:
  annotations:
    nginx.ingress.kubernetes.io/proxy-read-timeout: "120"

Rate Limiting

Control request rates per client:

metadata:
  annotations:
    nginx.ingress.kubernetes.io/limit-rps: "10"

Important Notes

Annotations are controller-specific—what works for NGINX won't work for Traefik. Always check your controller's documentation. They're also strings, so wrap numbers and booleans in quotes.

Key Takeaway: Ingress Annotations extend your Ingress capabilities with controller-specific features, allowing you to configure advanced routing behaviors like redirects, rewrites, and timeouts without modifying your application code.