liveBook · Manning

pathType field

As explained in Kubernetes in Action, Second Edition

The pathType field specifies the matching semantics applied to a request path in an Ingress rule.

The pathType field specifies how a request path is matched against paths in an Ingress rule. It controls whether matching is exact, element-by-element prefix matching, or delegated to the Ingress controller. section 12.2.2

Choose among three supported values:

  • Prefix compares path elements separated by /, rather than treating the rule as a simple character string. Thus /foo matches /foo/bar but not /foobar. section 12.2.2

Route exact and prefix paths

An Ingress can route /quote exactly to the quote service while routing /questions and paths beneath it to the quiz service. The manifest uses pathType: Exact for /quote and pathType: Prefix for /questions.

When multiple paths match a request, an Exact path takes priority. Matching remains case sensitive, and a trailing slash does not change Prefix matching. section 12.2.2

How Kubernetes in Action, Second Edition covers it

How deep it goes
Defines all three values and demonstrates Exact and Prefix matching, while delegating ImplementationSpecific behavior to the controller.
Examples
Uses /quote with Exact and /questions with Prefix in an Ingress manifest, then exercises them with curl.
What you can do after
Apply it via kubectl in an Ingress manifest to route exact paths and path-element prefixes to different services.
How it connects
Connects Ingress rules, request paths, backend services, and Ingress controllers.

Also explained in

Compare how 2 books explain pathType field →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Kubernetes in Action, Second Edition. The section links point to the parts of the book it draws on.