Configure an Azure managed cache for a Dedicated Cloud Gateway control plane

Uses: Kong Gateway
Incompatible with
on-prem
Related Documentation
Minimum Version
Kong Gateway - 3.13
TL;DR

After your Dedicated Cloud Gateway Azure network is ready, send a POST request to the /cloud-gateways/add-ons endpoint to create your Azure managed cache. Konnect will automatically create a Redis partial for you for control plane managed caches. Use the Redis configuration in a Redis-backed plugin, specifying the Konnect managed cache as the shared Redis configuration (for example: konnect-managed-a188516a-b1a6-4fad-9eda-f9b1be1b7159).

Prerequisites

This is a Konnect tutorial that requires Dedicated Cloud Gateways access.

If you don’t have a Konnect account, you can get started quickly with our onboarding wizard.

  1. The following Konnect items are required to complete this tutorial:
    • Personal access token (PAT): Create a new personal access token by opening the Konnect PAT page and selecting Generate Token.
    • Dedicated Cloud Gateway Control Plane: You can use an existing Dedicated Cloud Gateway or create a new one to use for this tutorial.
    • Network ID: The default Dedicated Cloud Gateway network ID can be found in API Gateway > Network
  2. Set these values as environment variables:
     export KONNECT_TOKEN='YOUR KONNECT TOKEN'
     export KONNECT_NETWORK_ID='KONNECT NETWORK ID'
    

A managed cache for Dedicated Cloud Gateways is a Redis-compatible datastore that powers all Redis-enabled plugins. This is fully managed by Kong in the region and provider of your choice, so you don’t have to host Redis infrastructure. Using a managed cache allows you to get up and running faster with Redis-backed plugins, such as Proxy Caching, Rate Limiting, AI Rate Limiting, ACME, and so on.

Set up an Azure managed cache on a single control plane

Managed caches are created at the control plane level. To create a managed cache, you must associate it with a control plane.

  1. List your existing Dedicated Cloud Gateway control planes:

    curl -X GET "https://global.api.konghq.com/v2/control-planes?filter%5Bcloud_gateway%5D=true" \
         --no-progress-meter --fail-with-body  \
         -H "Authorization: Bearer $KONNECT_TOKEN"
    
  2. Copy and export the control plane you want to configure the managed cache for:
    export CONTROL_PLANE_ID='YOUR CONTROL PLANE ID'
    
  3. Create a managed cache using the Cloud Gateways add-ons API:

    curl -X POST "https://global.api.konghq.com/v2/cloud-gateways/add-ons" \
         --no-progress-meter --fail-with-body  \
         -H "Authorization: Bearer $KONNECT_TOKEN" \
         --json '{
           "name": "managed-cache",
           "owner": {
             "kind": "control-plane",
             "control_plane_id": "'$CONTROL_PLANE_ID'",
             "control_plane_geo": "us"
           },
           "config": {
             "kind": "managed-cache.v0",
             "capacity_config": {
               "kind": "tiered",
               "tier": "small"
             }
           }
         }'
    

    When you configure a managed cache, you can select the small (~1 GiB capacity) cache size. Additional cache sizes will be supported in future updates. All regions are supported and you can configure the managed cache for multiple regions.

  4. Export the ID of your managed cache from the response:
    export MANAGED_CACHE_ID='YOUR MANAGED CACHE ID'
    
  5. Check the status of the managed cache. Once it’s marked as ready, it indicates the cache is ready to use:

    curl -X GET "https://global.api.konghq.com/v2/cloud-gateways/add-ons/$MANAGED_CACHE_ID" \
         --no-progress-meter --fail-with-body  \
         -H "Authorization: Bearer $KONNECT_TOKEN"
    

    This can take about 15 minutes.

Configure Redis for plugins

For control plane managed caches, you don’t need to manually configure a Redis partial. After the managed cache is ready, Konnect automatically creates a Redis partial configuration for you. Use the Redis configuration to set up Redis-supported plugins by selecting the automatically created Konnect-managed Redis configuration.

You can’t use the Redis partial configuration in custom plugins. Instead, use env referenceable fields directly.

  1. In the Konnect sidebar, click API Gateway.
  2. Click your Dedicated Cloud Gateway.
  3. In the API Gateway sidebar, click Plugins.
  4. Click New plugin.
  5. Select Rate Limiting Advanced.
  6. In the Rate Limit Window Type fields, enter 100 and 3600.
  7. Click View advanced parameters.
  8. In the Strategy dropdown menu, select “redis”.
  9. In the Shared Redis Configuration dropdown menu, select your Konnect-managed configuration. For example: konnect-managed-a188516a-b1a6-4fad-9eda-f9b1be1b7159
  10. In the Sync Rate field, enter 5.
  11. Click Save.

Important: If you’re configuring your plugins with decK, you must include the konnect-managed partial default lookup tag to ensure the managed cache partial is available. Add the following to your plugin config file:

_info:
default_lookup_tags:
  partials:
    - konnect-managed

Validate

Verify that the Rate Limiting Advanced plugin is using the managed cache partial configuration:

curl -X GET "https://us.api.konghq.com/v2/control-planes/$CONTROL_PLANE_ID/core-entities/plugins" \
     --no-progress-meter --fail-with-body  \
     -H "Authorization: Bearer $KONNECT_TOKEN"

In the response, locate your rate-limiting-advanced plugin and confirm that config.strategy is set to redis and that the partials array contains your managed Redis partial:

"partials": [
    {
      "id": "dcf411a3-475b-4212-bdf8-ae2b4dfa0a04",
      "name": "konnect-managed",
      "path": "config.redis"
    }
  ]

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!