Ingress Router
Every V3 Rack runs an ingress router that accepts external traffic and routes it to your Services. The ingress controller behind that router is nginx by default, and it handles ingress for every App on the Rack without any configuration on your part. Local Racks use the Minikube ingress instead.
On AWS, Contour, an Envoy-based ingress controller, is an opt-in alternative. You select it with the router_type Rack parameter. When Contour is active, an NLB points at Envoy pods, and Contour handles both external ingress and internalRouter Services.
Contour exists because the upstream free support for nginx is ending, so Convox is moving toward a supported ingress controller. Contour is the first alternative offered. nginx stays installed when you switch to Contour, so you can return to it at any time by setting router_type back to nginx.
Choosing a router
The router_type parameter accepts two values:
nginx(the default): the existing ingress controller, used on every Rack unless you opt in to Contour.contour: the Envoy-based ingress controller.
For a NEW Rack, set router_type=contour before you deploy any Apps. Every App then comes up on Contour from the start, with nothing to migrate and no downtime.
$ convox rack params set router_type=contour -r rackName
Switching an existing rack
Read this before switching
router_typeon a Rack that already has running Apps.Switching
router_typeon a Rack with running Apps takes EVERY App offline until you redeploy it. The instant the switch completes, your Apps stop serving external traffic.The switch does not move your existing Apps to the new controller automatically. Each App has no route on the new controller until its next deploy, so each App stays unreachable until you redeploy it. Redeploy each App with a deploy command (
convox deploy <app> -r rackName).On a Rack with several Apps, or where deploys are slow, this can be a lengthy outage. There is no automatic zero-downtime migration yet; it is planned for a later release.
Switching back to
nginxcosts the same: every App must be redeployed again.
Because of the outage described above, use router_type=contour only for brand-new Racks, or for staging and test Racks you can afford to take down and redeploy. Do NOT flip a production Rack to Contour expecting a quick, low-risk trial.
Internal router TLS
When router_type=contour, internalRouter Services serve HTTPS using a certificate from the Rack's own self-signed CA by default. This behavior is controlled by the contour_internal_tls parameter, which is on by default.
This is skip-verify HTTPS: it provides encryption in transit, not publicly verified trust. It matches the posture of nginx-internal, which also serves HTTPS with a non-verified certificate. In-cluster callers either skip verification or trust the Rack CA.
To serve plain HTTP on the internal router and skip the CA and certificate resources entirely, set contour_internal_tls=false.
$ convox rack params set contour_internal_tls=false -r rackName
contour_internal_tls has no effect on nginx Racks.
Tuning Contour and Envoy resources
Contour runs as a control plane, and Envoy runs as the data plane. Each has its own CPU and memory requests that you can tune independently.
Control-plane requests (Contour):
contour_cpu_request: CPU request for Contour control-plane pods.contour_memory_request: memory request for Contour control-plane pods. Worth raising on Racks with many routes.
Data-plane requests (Envoy):
envoy_cpu_request: CPU request for Envoy data-plane pods.envoy_memory_request: memory request for Envoy data-plane pods.
$ convox rack params set envoy_cpu_request=200m envoy_memory_request=512Mi -r rackName
nginx router image
The nginx router runs a Convox build of ingress-nginx controller v1.15.1 on AWS, GCP, Azure, DigitalOcean and metal Racks. The AWS internal router (internal_router) uses the same image. Local Racks use Minikube's own ingress controller.
| Rack version | Default router image |
|---|---|
3.25.13 to 3.26.0 |
convox/ingress-nginx:1.15.1-1 |
3.26.1 and later |
convox/ingress-nginx:1.15.1-2, whose nginx carries security fixes backported from later nginx releases |
The fixes are backports, so nginx -V still reports nginx 1.27.1. A Rack update that changes the image replaces the router pods once.
A Rack with nginx_image set (AWS and Azure) keeps the image it names through every Rack update, and does not get router fixes until the parameter is cleared. See nginx_image.
$ convox rack params set nginx_image= --force -r rackName
Updating parameters... OK
Request header limit
From Rack version 3.26.1, the nginx router answers a request with more than 1000 header lines with 400 Bad Request, page title 400 Request Header Or Cookie Too Large. The router's 32 KB limit on the request header block is unchanged, so only a request with many small headers, such as one that passed through a chain of proxies that each add headers, can reach the new limit.
| Protocol | Counted toward the limit |
|---|---|
| HTTP/1.1 | every header line, Host and Cookie included |
| HTTP/2 | every regular header field. Pseudo-headers (:method, :path, :authority, :scheme) and cookie fields are not counted |
Trailers and the headers the router adds before it passes the request to the App, such as X-Forwarded-For and X-Request-ID, are not counted. The limit applies to each request, not to a connection. A refused request shows as a 400 in the router access log.
To raise the limit on AWS, GCP or Azure, add an http-snippet to nginx_additional_config (AWS, GCP, Azure). Quote the argument, since the value contains a space and a semicolon:
$ convox rack params set 'nginx_additional_config=http-snippet=max_headers 2000;' -r rackName
Updating parameters... OK
nginx_additional_config holds every key in one comma-separated value. Include the keys already set, or the update removes them.
Open connections when a router pod stops
From Rack version 3.26.1, the nginx router gives open connections more time to finish when a router pod stops or the router reloads its configuration. This applies on AWS, GCP, Azure, DigitalOcean and metal, and to the AWS internal router. On a router_type=contour Rack, traffic goes through Envoy and these settings do not apply.
| Event | Open connections from 3.26.1 |
Before 3.26.1 |
|---|---|---|
| A router pod stops: a Rack update that changes the router, router autoscaling, a cluster autoscaler scale-down or a drain of its node | the pod keeps accepting new connections for 10 seconds, then gives open connections up to 540 seconds to finish. A connection still open after that is closed, 550 seconds after the pod was told to stop | closed 240 seconds after the pod was told to stop |
| The router reloads its configuration: the first deploy of an App with a routed Service, deleting one, or a change to a Service's domains, timeout, whitelist or annotations | connections opened before the reload have up to 540 seconds to finish | 240 seconds |
The limits apply to downloads, uploads, websockets, and the convox logs and convox exec sessions that pass through the router. A session that never ends is still closed when the limit is reached. The router pods that the update to 3.26.1 itself replaces stop with the earlier 240 second limit.
A connection also ends when the node it entered through is removed: the router's load balancer sends each connection to one node, which forwards it to a router pod. Replacing nodes (a Kubernetes version update, a node image update or a node_type change) closes every open connection, and removing one node closes the connections that entered through it.
On the public router, worker-shutdown-timeout in nginx_additional_config replaces the 540 second window. The router pod is stopped 600 seconds after it is told to stop, so a value above 580s gives no extra time.
Router replicas and placement
| Provider | Router replicas | Placement from 3.26.1 |
|---|---|---|
| AWS | 2 to 10, scaled on CPU. 1 with high_availability=false |
spread across availability zones, then across nodes |
| GCP | 2 to 10, scaled on CPU | spread across zones, then across nodes |
| Azure | 2 to 10, scaled on CPU. 1 with high_availability=false |
spread across nodes. Across availability zones only where additional node pools are zonal |
| DigitalOcean | 2 to 10, scaled on CPU. 1 with high_availability=false |
Kubernetes scheduler default |
| metal | 2 to 10, scaled on CPU | Kubernetes scheduler default |
The spread is a preference applied when a pod is scheduled. When no other zone has a node with room, a replica is still placed in the same zone, and after the router scales back down the remaining replicas can share a zone until the next router roll. The AWS internal router follows the same rule. The placement is not configurable.
With a single router pod, from Rack version 3.26.1 a node drain starts a replacement router pod on another node before the old one stops. A node failure still interrupts traffic until a new router pod runs.
Restricting nginx snippets
router_user_snippets_disable refuses deploys whose ingressAnnotations include nginx snippet annotations, which add raw configuration to the router that every App on the Rack shares. It is available on AWS, GCP, Azure, DigitalOcean and metal from Rack version 3.26.1.
Router logs
On an nginx Rack, Fluentd writes the router's lines to the Rack system log group /convox/<rack>/system, which convox rack logs reads. The public router's access lines go to the /nginx-access-logs stream, its error and controller output to service/ingress-nginx/<pod> streams, and the internal router's lines to service/ingress-nginx-internal/<pod> streams.
syslog_access_logsalso forwards the public router's access lines to thesyslogendpoint. The router's other lines are forwarded without it.router_log_redact_paramsmasks query parameter values in every router line before it is stored or forwarded.
On a contour Rack, Convox does not collect Envoy's access or error logs, so they reach neither CloudWatch nor syslog, and neither parameter has any effect.