You are browsing documentation for an older version. See the latest documentation here.

Services

In Kong Gateway, a service is an entity representing an external upstream API or microservice. For example, a data transformation microservice, a billing API, and so on.

The main attribute of a service is its URL. You can specify the URL with a single string, or by specifying its protocol, host, port, and path individually.

Service and route interaction

Services, in conjunction with routes, let you expose your services to clients with Kong Gateway. Kong Gateway abstracts the service from the clients by using routes. Since the client always calls the route, changes to the services(like versioning) don’t impact how clients make the call. Routes also allow the same service to be used by multiple clients and apply different policies based on the route used.

For example, if you have an external client and an internal client that need to access the hwservice service, but the external client should be limited in how often it can query the service to assure no denial of service. If a rate limit policy is configured for the service when the internal client calls the service, the internal client is limited as well. Routes solve this problem.

In the example above, two routes can be created, say /external and /internal, and both routes can point to hwservice. A policy can be configured to limit how often the /external route is used and the route can be communicated to the external client for use. When the external client tries to access the service via Kong Gateway using /external, they are rate limited. But when the internal client accesses the service via Kong Gateway using /internal, the internal client will not be limited.

Service configuration

When configuring access to your API, you start by specifying a service.

You can configure a service in Kong Gateway using the following methods: