Upstreams, targets and health
How Kong spreads traffic and takes a sick instance out of rotation.
Open this lesson in the learning hubKey points
- An Upstream is a named pool; Targets are the instances in it, each with a weight.
- Point a Service at the upstream name and Kong load balances across the targets for you.
- Weight is relative, so
weight: 100andweight: 900is a 10/90 split - handy for canaries. - Active health checks probe targets on a timer; passive checks watch real traffic for failures.
- An unhealthy target is skipped automatically and returns when it passes again.
Example
upstreams:
- name: orders-pool
targets:
- target: orders-1.internal:8080
weight: 900 # 90% of traffic
- target: orders-2.internal:8080
weight: 100 # 10% - the canary
healthchecks:
active:
http_path: /health
healthy: { interval: 5, successes: 2 }
unhealthy: { interval: 5, http_failures: 3 }
Weights give you canaries, health checks give you self-healing - together they are a safe rollout.
This is a reading copy. The full lesson — with the visual explainer, the interactive lab and a Run button for the code — lives in the Kong Course course, and every lesson in it is listed on the Kong Course contents page.