Upstream refers to an API, application, or micro-service that Kong Gateway forwards requests to.
In Kong Gateway, an upstream object represents a virtual hostname and can be used to health check, circuit break, and load balance incoming requests over multiple services.
Upstream and service interaction
You can configure a service to point to an upstream instead of a host.
For example, if you have a service called
example_service and an upstream called
example_upstream, you can point
example_upstream instead of specifying a host.
example_upstream upstream can then point both
In a real environment, the upstream points to the same service running on multiple systems.
This setup allows you to load balance between upstream targets.
For example, if an application is deployed across two different servers or upstream targets, Kong Gateway needs to load balance across both servers.
This is so that if one of the servers (like
httpbin.org in the previous example) is unavailable, it automatically detects the problem and routes all traffic to the working server (
You can add upstreams to a service in Kong Gateway using the following methods:
- Using Kong Manager
- Using the Admin API
- Using decK (YAML)
For more information about how to configure upstreams, see Configure Load Balancing.