Path based routing
ingress-nginx
as the default ingress controller
Argonaut provisions ingress-nginx
for managing ingress. This can be customized for specific application needs in the service descriptor art.yaml file.
This supports any annotations present here.
By default, some annotations are added such as an http -> https redirect
. This can be eliminated and overridden by using the services.external.overrideAnnotations field. Refer to this page for more details on overriding annotations.
Path based routing for services (apps)
Path based routing is supported by default. This is done by using the path
field in the services.external
section of the service descriptor art.yaml file.
An example snippet for the service section of the art.yaml
file is shown below. This exposes the container port 8080 on the path /myapp
on the domain myapp.mydomain.com
.
services:
- port: 8080
protocol: "tls-terminated"
external:
hosts:
- "myapp.mydomain.com"
paths: ["/myapp"]
extraAnnotations: {}
You can also specify multiple paths for a single service. This is done by specifying multiple paths in the paths
field. An example is shown below.
services:
- port: 8080
protocol: "tls-terminated"
external:
hosts:
- "myapp.mydomain.com"
paths: ["/myapp", "/myapp2"]
extraAnnotations: {}
Note: You can also add multiple domains to each app. The path based routing treatment will be common for all the listed domains.
Path rewrites
The app may expect a URL scheme that is different from what the caller uses. In such cases, you can use the rewrite
annotation to rewrite the path. An example is shown below.
services:
- port: 8080
protocol: "tls-terminated"
external:
hosts:
- "myapp.mydomain.com"
paths: ["/myapp"]
extraAnnotations:
nginx.ingress.kubernetes.io/rewrite-target: /
💡 Advanced path based routing
Advanced usage rewrite rules can be found on the official ingress-nginx
documentation including complex examples. Use the paths
and annotations
fields from the example and plug it into the art.yaml
file.