This guide creates a Konnect-managed global control plane, connects a Kubernetes zone, and verifies that the zone is online.
Connect a Kubernetes zone to Konnect with the API
Create a new global control plane running v3, deploy a 3.x zone control plane with its Konnect credentials, and verify that the zone connects.
Prerequisites
Kong Konnect
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.
-
Set the personal access token as an environment variable:
export KONNECT_TOKEN='YOUR KONNECT TOKEN'
kongctl v1.28.4+
This tutorial uses kongctl to manage Konnect resources programmatically. We recommend keeping kongctl up to date with the latest version (1.28.4).
- Install kongctl from developer.konghq.com/kongctl.
-
Verify the installation:
kongctl version
Create a global control plane in Konnect
-
Set the region where you will create the global control plane:
export KONNECT_REGION='us' -
Create a Kong Mesh v3 control plane in Konnect and save its ID to your environment:
CONTROL_PLANE_ID=$(curl -X POST "https://$KONNECT_REGION.api.konghq.com/v1/mesh/control-planes" \ --no-progress-meter --fail-with-body \ -H "Authorization: Bearer $KONNECT_TOKEN"\ -H "Content-Type: application/json" \ --json '{ "name": "example-cp", "version": "v3" }' | jq -r ".id" )
Give the zone credentials to connect
The zone uses a system account access token with the Connector role on this control plane.
-
Create a system account and save its
idasACCOUNT_ID:ACCOUNT_ID=$(curl -X POST "https://global.api.konghq.com/v3/system-accounts" \ --no-progress-meter --fail-with-body \ -H "Authorization: Bearer $KONNECT_TOKEN"\ -H "Content-Type: application/json" \ --json '{ "name": "mesh-zone-1", "description": "Connect zone-1", "konnect_managed": false }' | jq -r ".id" ) -
Assign the account the
Connectorrole on the control plane:curl -X POST "https://global.api.konghq.com/v3/system-accounts/$ACCOUNT_ID/assigned-roles" \ --no-progress-meter --fail-with-body \ -H "Authorization: Bearer $KONNECT_TOKEN"\ -H "Content-Type: application/json" \ --json '{ "role_name": "Connector", "entity_type_name": "Mesh Control Planes", "entity_id": "'$CONTROL_PLANE_ID'", "entity_region": "'$KONNECT_REGION'" }' -
Set the token to expire in 30 days. Change the number of days if your organization’s token policy requires a shorter lifetime:
export TOKEN_EXPIRES_AT=$(jq -nr 'now + 30*24*60*60 | todate') -
Create the token and save the returned
tokenasCONTROL_PLANE_TOKEN:CONTROL_PLANE_TOKEN=$(curl -X POST "https://global.api.konghq.com/v3/system-accounts/$ACCOUNT_ID/access-tokens" \ --no-progress-meter --fail-with-body \ -H "Authorization: Bearer $KONNECT_TOKEN"\ -H "Content-Type: application/json" \ --json '{ "name": "zone-1", "expires_at": "'$TOKEN_EXPIRES_AT'" }' | jq -r ".token" )
Deploy the zone control plane
-
Set the KDS address for the same region as the global control plane, and create a working directory:
export CONTROL_PLANE_URL="grpcs://$KONNECT_REGION.mesh.sync.konghq.com:443" export MESH_INSTALL_DIR="$PWD/kong-mesh-zone" mkdir -p "$MESH_INSTALL_DIR" cd "$MESH_INSTALL_DIR" -
Add the Kong Mesh Helm repository:
helm repo add kong-mesh https://kong.github.io/kong-mesh-charts helm repo update -
Create the zone namespace:
kubectl create namespace kong-mesh-system -
Store the zone token in a Secret:
kubectl -n kong-mesh-system create secret generic cp-token \ --from-literal=token="$CONTROL_PLANE_TOKEN" -
Create
values.yaml:cat <<EOF > values.yaml kuma: controlPlane: mode: zone zone: zone-1 kdsGlobalAddress: $CONTROL_PLANE_URL konnect: cpId: $CONTROL_PLANE_ID zoneToken: secretName: cp-token key: token EOF -
Install the zone control plane:
helm upgrade --install kong-mesh kong-mesh/kong-mesh \ --namespace kong-mesh-system --version "3.0.0" \ --values values.yaml --wait --timeout 5mThis single-zone test doesn’t need zone proxies; add mesh-scoped zone proxies when connecting zones or using
MeshExternalService.
Validate
Confirm the zone is connected to your global control plane:
kongctl inspect mesh zones \
--control-plane-id "$CONTROL_PLANE_ID" --region "$KONNECT_REGION" \
--pat "$KONNECT_TOKEN"The zone should report an Online status:
NAME STATUS
zone-1 OnlineIf a zone is missing or not Online, check:
- The zone’s control plane logs
- Outbound access to the KDS address
- The control plane ID
- The system account’s
Connectorrole and token
Cleanup
Remove the Kubernetes zone
Delete the test namespace:
kubectl delete namespace kong-mesh-demoUninstall the zone release:
helm uninstall kong-mesh --namespace kong-mesh-systemDelete the zone namespace and the cp-token Secret in it:
kubectl delete namespace kong-mesh-systemDelete the working directory
Leave the zone working directory and delete it:
cd "$(dirname "$MESH_INSTALL_DIR")"
rm -rf "$MESH_INSTALL_DIR"Delete the control plane
Delete the example-cp control plane. This also removes its mesh configuration:
curl --fail-with-body -sS -X DELETE \
"https://$KONNECT_REGION.api.konghq.com/v1/mesh/control-planes/$CONTROL_PLANE_ID" \
-H "Authorization: Bearer $KONNECT_TOKEN"Delete the system account
Delete the mesh-zone-1 system account:
curl --fail-with-body -sS -X DELETE \
"https://global.api.konghq.com/v3/system-accounts/$ACCOUNT_ID" \
-H "Authorization: Bearer $KONNECT_TOKEN"