Map Gateway Manager Services in Service Catalog
Create a Service Catalog service and associate it with your Gateway Manager resources to visualize Services across multiple Control Planes.
Prerequisites
Kong Konnect
This is a Konnect tutorial and requires a Konnect personal access token.
-
Create a new personal access token by opening the Konnect PAT page and selecting Generate Token.
-
Export your token to an environment variable:
export KONNECT_TOKEN='YOUR_KONNECT_PAT'
-
Run the quickstart script to automatically provision a Control Plane and Data Plane, and configure your environment:
curl -Ls https://get.konghq.com/quickstart | bash -s -- -k $KONNECT_TOKEN --deck-output
This sets up a Konnect Control Plane named
quickstart
, provisions a local Data Plane, and prints out the following environment variable exports:export DECK_KONNECT_TOKEN=$KONNECT_TOKEN export DECK_KONNECT_CONTROL_PLANE_NAME=quickstart export KONNECT_CONTROL_PLANE_URL=https://us.api.konghq.com export KONNECT_PROXY_URL='http://localhost:8000'
Copy and paste these into your terminal to configure your session.
Kong Gateway running
This tutorial requires Kong Gateway Enterprise. If you don’t have Kong Gateway set up yet, you can use the quickstart script with an enterprise license to get an instance of Kong Gateway running almost instantly.
-
Export your license to an environment variable:
export KONG_LICENSE_DATA='LICENSE-CONTENTS-GO-HERE'
-
Run the quickstart script:
curl -Ls https://get.konghq.com/quickstart | bash -s -- -e KONG_LICENSE_DATA
Once Kong Gateway is ready, you will see the following message:
Kong Gateway Ready
decK
decK is a CLI tool for managing Kong Gateway declaratively with state files. To complete this tutorial you will first need to install decK.
Required entities
For this tutorial, you’ll need Kong Gateway entities, like Gateway Services and Routes, pre-configured. These entities are essential for Kong Gateway to function but installing them isn’t the focus of this guide. Follow these steps to pre-configure them:
-
Run the following command:
echo ' _format_version: "3.0" services: - name: example-service url: http://httpbin.konghq.com/anything ' | deck gateway apply -
To learn more about entities, you can read our entities documentation.
Create a service in Service Catalog
In this tutorial, you’ll map Gateway Services from Gateway Manager to a service in Service Catalog. Because the Gateway Manager integration is built-in, you don’t need to install or authorize it like other Service Catalog integrations.
Create a service that you’ll map to your Gateway Manager resources:
curl -X POST "https://us.api.konghq.com/v1/catalog-services" \
-H "Authorization: Bearer $KONNECT_TOKEN" \
--json '{
"name": "billing",
"display_name": "Billing Service"
}'
Export the Service Catalog service ID:
export SERVICE_ID='YOUR-SERVICE-ID'
List Gateway Manager resources
Before you can map a resource to Service Catalog, you first need to find the resources that are pulled in from Gateway Manager:
curl -X GET "https://us.api.konghq.com/v1/resources?filter%5Bintegration.name%5D=gateway-manager" \
-H "Authorization: Bearer $KONNECT_TOKEN"
Export the resource ID you want to map to the service:
export GATEWAY_MANAGER_RESOURCE_ID='YOUR-RESOURCE-ID'
Map resources to a Service Catalog service
Now, you can map the Gateway Manager resource to the service:
curl -X POST "https://us.api.konghq.com/v1/resource-mappings" \
-H "Authorization: Bearer $KONNECT_TOKEN" \
--json '{
"service": "'$SERVICE_ID'",
"resource": "'$GATEWAY_MANAGER_RESOURCE_ID'"
}'
Validate the mapping
To confirm that the Gateway Manager resource is now mapped to the intended service, list the service’s mapped resources:
curl -X GET "https://global.api.konghq.com/v1/catalog-services/$SERVICE_ID/resources" \
-H "Authorization: Bearer $KONNECT_TOKEN"