Path Types and Matching
What you'll learn: How Kubernetes Ingress uses three distinct path types—Exact, Prefix, and ImplementationSpecific—to route traffic with different levels of precision.
When you define Ingress rules with paths (like /api or /shop/products), Kubernetes needs to know how to match incoming requests against those paths. That's where path types come in—they tell the Ingress controller exactly how strict or flexible to be when comparing URLs.
The Three Path Types
Exact matches only when the request path is character-for-character identical to your rule. If you specify /api/users with Exact, then /api/users matches perfectly, but /api/users/ or /api/users/123 do not.
Prefix matches when the request path starts with your specified path. Think of it like a "begins with" filter. A Prefix rule for /api matches /api, /api/users, /api/users/123, and so on. It's the most commonly used type for hierarchical routing.
ImplementationSpecific leaves the matching logic entirely up to your Ingress controller. Different controllers might handle this differently—NGINX Ingress might use regular expressions, while others might apply custom logic. Use this when you need vendor-specific features, but understand it reduces portability.
Why This Matters
Choosing the right path type prevents routing conflicts and unexpected behavior. Imagine you have two rules: /shop (Prefix) and /shop (Exact). The Prefix rule would catch everything under /shop/*, while the Exact rule only catches the bare /shop endpoint—they serve different purposes.
Key Takeaway: Path types control routing precision in Ingress—use Exact for specific endpoints, Prefix for hierarchical paths, and ImplementationSpecific only when you need controller-specific matching behavior.