Services and Routes

TL;DR

Create an HTTPRoute that points to a Kubernetes service in your cluster.

Prerequisites

This page is part of the Getting Started with KIC series.

Complete the previous page, Install Kong Ingress Controller before completing this page.

How Kubernetes resources map to Kong Gateway entities

A Service inside Kubernetes is a way to abstract an application that is running on a set of Pods. This maps to two entities in Kong Gateway: Service and Upstream.

The Service entity in Kong Gateway holds the protocol information needed to talk to the upstream service and various other protocol-specific settings. The Upstream object defines load balancing and health-checking behavior.

Routes are configured using Gateway API or Ingress resources, such as HTTPRoute, TCPRoute, GRPCRoute, Ingress and more.

Deploy an echo service

Let’s start by deploying an echo service which returns information about the Kubernetes cluster:

kubectl apply -f https://developer.konghq.com/manifests/kic/echo-service.yaml -n kong
Copied to clipboard!

Create an HTTPRoute / Ingress

To route traffic to the echo service, create an HTTPRoute or Ingress resource:

Validate your configuration

Once the resource has been reconciled, you can call the /echo endpoint and Kong Gateway will route the request to the echo service:

 curl "$PROXY_IP/echo"
Copied to clipboard!

Did this doc help?

Something wrong?

Help us make these docs great!

Kong Developer docs are open source. If you find these useful and want to make them better, contribute today!