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.
Configure an Azure managed cache for a Dedicated Cloud Gateway control plane group
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.
For control plane groups, you must manually create a Redis partial on each control plane that references the Konnect managed cache.
Then use the Redis configuration in a Redis-backed plugin, specifying the Konnect managed cache as the shared Redis configuration (for example: konnect-managed).
Prerequisites
Dedicated Cloud Gateway
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.
- 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
- Set these values as environment variables:
export KONNECT_TOKEN='YOUR KONNECT TOKEN' export KONNECT_NETWORK_ID='KONNECT NETWORK ID'Copied!
Set up an Azure managed cache on a control plane group
Set up a control plane, control plane group, and a managed cache for the group. All control planes in the group will have access to the managed cache.
Create a hybrid control plane
First, you need to create a hybrid control plane. The Dedicated Cloud control plane group aggregates the hybrid control plane’s configurations and passes them on to the Dedicated Cloud Gateway data plane nodes.
- In the Konnect sidebar, click API Gateway.
- Click New.
- Select New API gateway.
- Select Self-managed.
- Select Docker.
- In the Gateway name field, enter
hybrid-cp. - Click Create.
- Scroll and click Set up later.
- Copy and export the control plane ID that you’ll configure the partial for:
export CONTROL_PLANE_ID='YOUR CONTROL PLANE ID'Copied!
Create a Dedicated Cloud control plane group
You can use a Dedicated Cloud control plane group to isolate the Gateway configuration by team while still sharing a Dedicated Cloud Gateway cluster.
- In the Konnect sidebar, click API Gateway.
- Click New.
- Select New control plane group.
- In the Name field, enter
dcgw-control-plane-group. - From the Control Planes dropdown menu, select
hybrid-cp. - For the Node Type, select Dedicated Cloud.
- Click Save.
- Click Configure data plane.
- From the Provider dropdown menu, select “Azure”.
- From the Region dropdown menu, select the region you want to configure the cluster in.
-
Edit the Network range as needed.
Important: Your Azure virtual network must use a different IP than your network in Konnect, which is
10.0.0.0/16by default but can be edited. - From the Access dropdown menu, select “Public” or “Private”.
- Click Create data plane node.
-
Click Go to overview.
Important: Wait until your Azure network displays as
Readybefore proceeding to the next step. - Copy and export the ID of the control plane group you want to configure the managed cache for:
export CONTROL_PLANE_GROUP_ID='YOUR CONTROL PLANE GROUP ID'Copied!
Create a managed cache for your control plane group
Now that you’ve configured your Dedicated Cloud control plane group, you can add a managed cache to the control plane group.
-
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-group", "control_plane_group_id": "'$CONTROL_PLANE_GROUP_ID'", "control_plane_group_geo": "us" }, "config": { "kind": "managed-cache.v0", "capacity_config": { "kind": "tiered", "tier": "small" } } }'Copied!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.
- Export the ID of your managed cache from the response:
export MANAGED_CACHE_ID='YOUR MANAGED CACHE ID'Copied! -
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"Copied!This can take about 15 minutes.
Configure Redis for plugins
Next, you must manually create a Redis partial configuration on each control plane where Redis-backed plugins are enabled. Each Redis partial will use the managed cache that you just set up.
Note: You can’t use the Redis partial configuration in custom plugins. Instead, use env referenceable fields directly.
Create a managed cache Redis partial
Now that you’ve created your managed cache, you must manually create a Redis partial for it.
-
Create a Redis partial configuration:
curl -X POST "https://us.api.konghq.com/v2/control-planes/$CONTROL_PLANE_ID/core-entities/partials" \ --no-progress-meter --fail-with-body \ -H "Authorization: Bearer $KONNECT_TOKEN" \ --json '{ "name": "konnect-managed", "type": "redis-ee", "config": { "host": "{vault://env/ADDON_MANAGED_CACHE_HOST}", "port": "{vault://env/ADDON_MANAGED_CACHE_PORT}", "username": "{vault://env/ADDON_MANAGED_CACHE_USERNAME}", "ssl": true, "ssl_verify": true, "server_name": "{vault://env/ADDON_MANAGED_CACHE_SERVER_NAME}", "database": 0, "connect_timeout": 2000, "read_timeout": 5000, "send_timeout": 2000, "keepalive_backlog": 512, "keepalive_pool_size": 256, "connection_is_proxied": false, "cloud_authentication": { "auth_provider": "azure", "azure_client_id": "{vault://env/ADDON_MANAGED_CACHE_AZURE_CLIENT_ID}", "azure_client_secret": "{vault://env/ADDON_MANAGED_CACHE_AZURE_CLIENT_SECRET}", "azure_tenant_id": "{vault://env/ADDON_MANAGED_CACHE_AZURE_TENANT_ID}" } } }'Copied! -
Repeat the previous step for all the control planes in your control plane group.
Apply the managed cache Redis partial to a plugin
To demonstrate how you can use a managed cache in a Redis-supported plugin, let’s apply this configuration to a Rate Limiting Advanced plugin.
- In the Konnect sidebar, click API Gateway.
- Click your Dedicated Cloud Gateway.
- In the API Gateway sidebar, click Plugins.
- Click New plugin.
- Select Rate Limiting Advanced.
- In the Rate Limit Window Type fields, enter
100and3600. - Click View advanced parameters.
- In the Strategy dropdown menu, select “redis”.
- In the Shared Redis Configuration dropdown menu, select your Konnect-managed configuration.
- In the Sync Rate field, enter
5. - Click Save.
- Repeat steps 1 - 11 for each control plane in your control plane group.
Important: If you’re configuring your plugins with decK, you must include the
konnect-managedpartial 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-managedCopied!
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"
}
]