Skip to content

VirtualService Routing

How your app gets its URL

External requests reach your app at /${ENTITY_NAMESPACE}/${APP_SLUG}/... โ€” today, that's /hello-world/....

This is set through values.yaml โ†’ istio.pathPrefix.


VirtualService configuration

Everything below is driven by values.yaml, except the URL rewrite:

Field Value key Default
Host istio.host api.playground.france-identite.gouv.local
Gateway istio.gateway istio-system/api-gateway
URL prefix to match istio.pathPrefix /hello-world/
URL rewrite (hardcoded) /
Destination service (derived from the chart name) helm-hello-world
Destination port service.port 5173

Don't change istio.host or istio.gateway โ€” they point at the platform's shared API Gateway. The only thing you should adapt per service is istio.pathPrefix, and it must be unique: if two services use the same prefix, their traffic will collide.


How a request travels through the system

Client โ†’ Istio Gateway (istio.host)
       โ†’ VirtualService (matches istio.pathPrefix, rewrites to /)
       โ†’ Service (service.port = 5173)
       โ†’ Your pod's container (service.containerPort = 80)
  1. The request arrives at the gateway for istio.host
  2. Istio checks whether the path matches your istio.pathPrefix
  3. If it matches, the URL is rewritten to /
  4. Traffic is forwarded to your Service
  5. The Service forwards it to your container's port

Which value drives which field

Template field Value key Configurable via values.yaml?
metadata.name Chart name Yes
spec.hosts istio.host Yes
spec.gateways istio.gateway Yes
spec.http.match.uri.prefix istio.pathPrefix Yes
spec.http.rewrite.uri (hardcoded to /) No
spec.http.route.destination.host Chart name Yes
spec.http.route.destination.port.number service.port Yes

Before you change anything, check the ports line up

  • VirtualService's destination port must equal service.port
  • Service's targetPort must equal service.containerPort

Assumption

The gateway istio-system/api-gateway already exists and is configured for this VirtualService's host. It's referenced by the chart but not created by it.


Sources