Skip to main content
Version: 0.17.0

Services

An ingress configuration file may define zero or more services. Each service groups a set of routes with one or more upstreams and an optional load balancing strategy.

services = [
{
# The service's unique name across all ingress files.
name = "api"

# Load balancing strategy for this service.
load_balancing_strategy = "round_robin"

# Optional: health checking for upstreams.
health_check = {
enable = false
failure_threshold = 3
unhealthy_cooldown_seconds = 10
}

# Optional: circuit breaker for upstream protection.
circuit_breaker = { ... }

# Routes and upstreams are defined within the service.
routes = [ ... ]
upstreams = [ ... ]
}
]

The health_check block is optional. When you omit it, health checking stays off. When you write it, you must set enable, and the other fields fall back to the defaults in the field table below.

Fields​

FieldTypeDefaultDescription
namestring(required)The service's unique name across all ingress files. HCL also accepts it as a block label: services "api" { ... }.
load_balancing_strategystring"failover"The load balancing strategy. See supported strategies below.
health_check.enableboolean(required)Enable health checking for upstreams. Required whenever you write the health_check block.
health_check.failure_thresholdinteger3Number of consecutive failures before marking an upstream as unhealthy.
health_check.unhealthy_cooldown_secondsinteger10Seconds to wait before re-checking an unhealthy upstream.
circuit_breakerobject(optional)Circuit breaker configuration. See Circuit Breaker.
routeslist(object)(required)Route matching rules. See Routes.
upstreamslist(object)(required)Backend upstream servers. See Upstreams.

Load Balancing Strategies​

  • failover: Always picks the first healthy upstream in the list. The list follows the order in your configuration, across socket and endpoint upstreams.
  • round_robin: Distributes requests evenly across upstreams. Respects the weight field on each upstream.
  • request_pressure: Picks the upstream with the lowest recent request pressure (heuristic-based, not transport-level).
  • random: Picks a random healthy upstream.
  • sticky_hash: Consistent hashing based on request characteristics.