This guide creates a Konnect-managed global control plane and connects a Universal (VM or bare-metal) zone.
Connect a Universal 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'
A VM or bare-metal host
A supported VM or bare-metal host.
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" -
Download and run the installer:
curl --fail -L https://developer.konghq.com/mesh/installer.sh | VERSION="3.0.0" sh -
Write the zone token to a file:
printf '%s' "$CONTROL_PLANE_TOKEN" > cp-token -
Create
config.yaml:cat <<EOF > config.yaml environment: universal mode: zone store: type: memory multizone: zone: name: zone-1 globalAddress: $CONTROL_PLANE_URL kmesh: multizone: zone: konnect: cpId: $CONTROL_PLANE_ID EOFUse
store.type: memoryfor testing purposes only. In a production environment, use PostgreSQL and plan persistence and availability. For more information, see the Universal control plane reference. -
Start the control plane in the background and write its output to
kuma-cp.log:KUMA_MULTIZONE_ZONE_KDS_AUTH_TOKEN_PATH="$MESH_INSTALL_DIR/cp-token" \ nohup "$MESH_INSTALL_DIR/kong-mesh-3.0.0/bin/kuma-cp" run --config-file config.yaml \ > kuma-cp.log 2>&1 & echo $! > kuma-cp.pid -
Wait for the control plane to report that it’s ready:
curl --fail --silent --retry 30 --retry-delay 2 --retry-connrefused http://localhost:5680/readyIf the command fails, check
kuma-cp.logfor the startup error.
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
Stop the zone control plane
Stop the control plane this guide started:
kill "$(cat "$MESH_INSTALL_DIR/kuma-cp.pid")"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"