Octopus
1.x
Docs/Octopus/Upstreams
Open

Reading3 min
Updated31 Jul 2026
Sourcev1/configuration/upstreams.mdx

Upstreams

An upstream is a named backend service made up of one or more instances. Routes target an upstream by name. The upstreams field is an array; it defaults to empty.

upstreams:
  - name: user-service
    lb_policy: round_robin
    instances:
      - id: user-1
        host: 10.0.0.11
        port: 8080
        weight: 1
      - id: user-2
        host: 10.0.0.12
        port: 8080
        weight: 2
    health_check:
      type: http
      path: /healthz
      interval: 10s
      timeout: 2s
      healthy_threshold: 2
      unhealthy_threshold: 3
    circuit_breaker:
      error_threshold: 50.0
      min_requests: 20
      timeout: 30s

upstreams[]01

KeyTypeDefaultDescription
namestringUnique upstream name, referenced by routes[].upstream. Required.
instancesarrayService instances. Required (may be empty, but routing then has no target).
lb_policystringround_robinLoad-balancing policy. See valid values.
health_checkobjectnoneActive health checking. See below.
circuit_breakerobjectnoneCircuit breaker. See below.

Load-balancing policy02

lb_policy is a string. The recognized values are:

ValueStrategy
round_robinRound-robin (default).
least_connections (alias least_conn)Fewest in-flight connections.
weighted_round_robin (alias weighted)Round-robin weighted by instance weight.
randomRandom selection.
ip_hashConsistent hash on client IP.
Warning

Only the Kubernetes/operator-driven path currently maps lb_policy (and instance weight) to a live balancer. When upstreams are registered from a static config file, the gateway uses round-robin regardless of lb_policy, and health_check / circuit_breaker on the upstream are parsed and validated but not yet wired into the static registration path. See Load balancing, Health checks, and Circuit breaker for the runtime model.

instances[]03

KeyTypeDefaultDescription
idstringUnique instance ID. Required (must be non-empty).
hoststringHost or IP address. Required (must be non-empty).
portintegerPort number. Required (must be greater than zero).
weightinteger1Relative weight for weighted load balancing.
metadatamap of string→string{}Arbitrary instance metadata.

Health check04

The health_check object configures active health checking for the upstream.

health_check:
  type: http
  path: /healthz
  interval: 10s
  timeout: 2s
  healthy_threshold: 2
  unhealthy_threshold: 3
KeyTypeDefaultDescription
typestringCheck type: http, tcp, or grpc. Required. (YAML key is type.)
pathstringnonePath for HTTP checks.
intervaldurationTime between checks. Required.
timeoutdurationTimeout for each check. Required.
healthy_thresholdinteger2Consecutive successes before marking healthy.
unhealthy_thresholdinteger3Consecutive failures before marking unhealthy.

Circuit breaker05

The circuit_breaker object trips the upstream after a sustained error rate.

circuit_breaker:
  error_threshold: 50.0
  min_requests: 20
  timeout: 30s
KeyTypeDefaultDescription
error_thresholdfloatError-rate percentage that opens the breaker. Required.
min_requestsintegerMinimum requests in the window before the breaker can trip. Required.
timeoutdurationHow long the breaker stays open before probing again. Required.