Skip to content

Commit 1c91ba6

Browse files
authored
Feat(Mesh): Federate zone control plane (#3471)
* prereqs * replace content with prereqs * Update config.yaml * draft * Update kumactl.md * Update kumactl.md * Update federate-zone-control-plane.md * fix submodules * Update federate-zone-control-plane.md * Update federate-zone-control-plane.md * Update federate-zone-control-plane.md * Create kumactl.md * Update federate-zone-control-plane.md * Update federate-zone-control-plane.md * Update federate-zone-control-plane.md * Update federate-zone-control-plane.md * Update federate-zone-control-plane.md
1 parent c7ce9bd commit 1c91ba6

File tree

6 files changed

+225
-40
lines changed

6 files changed

+225
-40
lines changed

app/_data/kuma_to_mesh/config.yaml

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,7 @@ links:
1616
'/features/?': '/mesh/enterprise/'
1717

1818
pages:
19-
# Must for GA
20-
-
21-
22-
path: app/_src/guides/federate-kv.md
23-
title: 'Federate zone Control Plane'
24-
description: 'Learn how to federate a {{site.base_product}} zone Control Plane into a multi-zone deployment. This guide walks through setting up a global Control Plane, copying resources, connecting zones, and verifying policy synchronization.'
25-
url: /mesh/federate/
26-
related_resources:
27-
- text: Add a builtin gateway
28-
url: '/mesh/add-builtin-gateway/'
29-
- text: 'Producer and Consumer policies'
30-
url: /mesh/consumer-producer-policies/
31-
- text: 'Multi-zone deployment'
32-
url: '/mesh/mesh-multizone-service-deployment/'
33-
min_version:
34-
mesh: '2.6'
19+
# Must for GA
3520
-
3621
path: app/_src/guides/gateway-api.md
3722
title: 'Kubernetes Gateway API'

app/_how-tos/deploy-mesh-on-kubernetes.md

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,7 @@ prereqs:
3030
- title: Helm
3131
include_content: prereqs/helm
3232
- title: A running Kubernetes cluster
33-
content: |
34-
This guide requires a running Kubernetes cluster. If you already have a Kubernetes cluster running, you can skip this step.
35-
It can be a cluster running locally, like Docker, or in a public cloud like AWS EKS, GCP GKE, etc.
36-
37-
For example, if you are using [minikube](https://minikube.sigs.k8s.io/docs/):
38-
```sh
39-
minikube start -p mesh-zone
40-
```
33+
include_content: prereqs/kubernetes/mesh-cluster
4134

4235
cleanup:
4336
inline:
Lines changed: 219 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,219 @@
1+
---
2+
title: 'Federate a zone control plane'
3+
description: 'Learn how to federate a {{site.base_product}} zone control plane into a multi-zone deployment. This guide walks through setting up a global control plane, copying resources, connecting zones, and verifying policy synchronization.'
4+
5+
content_type: how_to
6+
permalink: /mesh/federate/
7+
bread-crumbs:
8+
- /mesh/
9+
related_resources:
10+
- text: Add a builtin gateway
11+
url: '/mesh/add-builtin-gateway/'
12+
- text: 'Producer and Consumer policies'
13+
url: /mesh/consumer-producer-policies/
14+
- text: 'Multi-zone deployment'
15+
url: '/mesh/mesh-multizone-service-deployment/'
16+
17+
min_version:
18+
mesh: '2.6'
19+
20+
products:
21+
- mesh
22+
23+
tldr:
24+
q: How can I federate a zone control plane in a multi-zone deployment?
25+
a: |
26+
1. Create a zone control plane and a global control plane in separate Kubernetes clusters.
27+
1. Copy resources from the zone control plane to the global control plane.
28+
1. Connect the two control planes by updating the zone control plane's Helm deployment.
29+
30+
prereqs:
31+
inline:
32+
- title: Helm
33+
include_content: prereqs/helm
34+
- title: Install kumactl
35+
include_content: prereqs/tools/kumactl
36+
- title: A running Kubernetes cluster
37+
include_content: prereqs/kubernetes/mesh-cluster
38+
- title: Install {{site.mesh_product_name}} with demo configuration
39+
include_content: prereqs/kubernetes/mesh-quickstart
40+
41+
cleanup:
42+
inline:
43+
- title: Clean up kumactl control plane
44+
include_content: cleanup/products/kumactl
45+
- title: Clean up {{site.mesh_product_name}} resources
46+
content: |
47+
To clean up your environment, remove the Docker containers, network, temporary directory, and the control plane configuration. Run the following command:
48+
49+
```sh
50+
minikube delete --profile mesh-zone
51+
minikube delete --profile mesh-global
52+
```
53+
54+
---
55+
56+
## Start a new Kubernetes cluster for the global control plane
57+
58+
We've created a zone control plane in the [prerequisites](#install-kong-mesh-with-demo-configuration), now we need a global control plane. The zone a global control planes can't be in the same Kubernetes cluster, so we must start by creating a new cluster:
59+
```sh
60+
minikube start -p mesh-global
61+
```
62+
63+
Use the minikube tunnel feature to provision local load balancer addresses:
64+
```sh
65+
nohup minikube tunnel -p mesh-global &
66+
```
67+
68+
## Deploy the global control plane
69+
70+
Run the following command to deploy a global control plane:
71+
72+
```sh
73+
helm install --kube-context mesh-global --create-namespace --namespace kong-mesh-system \
74+
--set kuma.controlPlane.mode=global \
75+
--set kuma.controlPlane.defaults.skipMeshCreation=true \
76+
kong-mesh kong-mesh/kong-mesh
77+
```
78+
79+
We'll skip the default mesh creation since we'll bring the mesh from the zone control plane in the next steps.
80+
81+
## Set up kumactl
82+
83+
Before we start migrating, we need to set up kumactl, which we'll use to export resources.
84+
85+
1. Run the following command to expose the control plane's API server. We'll need this to access kumactl:
86+
87+
```sh
88+
kubectl --context mesh-zone port-forward svc/kong-mesh-control-plane -n kong-mesh-system 5681:5681
89+
```
90+
91+
1. In a new terminal, check that kumactl is installed and that its directory is in your path:
92+
93+
```sh
94+
kumactl
95+
```
96+
97+
If the command is not found:
98+
99+
1. Make sure that kumactl is [installed](#install-kumactl)
100+
1. Add the {{site.mesh_product_name}} binaries directory to your path:
101+
102+
```sh
103+
export PATH=$PATH:$(pwd)/{{site.mesh_product_name_path}}-{{site.data.mesh_latest.version}}/bin
104+
```
105+
106+
1. Export your admin token and add your control plane:
107+
108+
```sh
109+
export ZONE_USER_ADMIN_TOKEN=$(kubectl --context mesh-zone get secrets -n kong-mesh-system admin-user-token -o json | jq -r .data.value | base64 -d)
110+
kumactl config control-planes add \
111+
--address http://localhost:5681 \
112+
--headers "authorization=Bearer $ZONE_USER_ADMIN_TOKEN" \
113+
--name "my-cp" \
114+
--overwrite
115+
```
116+
117+
## Copy resources from the zone control plane to the global control plane
118+
119+
1. Export the external IP to use to access the global control plane:
120+
```sh
121+
export EXTERNAL_IP=host.minikube.internal
122+
```
123+
124+
{:.info}
125+
> If you're not using minikube, you can find your external IP with this command:
126+
> ```sh
127+
> export EXTERNAL_IP=$(kubectl --context mesh-global get svc -n kong-mesh-system kong-mesh-global-zone-sync -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
128+
> ```
129+
130+
1. Export the zone control plane resources:
131+
132+
```sh
133+
kumactl export --profile federation-with-policies --format kubernetes > resources.yaml
134+
```
135+
136+
1. Apply the resources to the global control plane:
137+
138+
```sh
139+
kubectl apply --context mesh-global -f resources.yaml
140+
```
141+
142+
## Connect the control planes
143+
144+
Update the zone control plane's Helm deployment to configure the connection to the global control plane:
145+
146+
```sh
147+
helm upgrade --kube-context mesh-zone --namespace kong-mesh-system \
148+
--set kuma.controlPlane.mode=zone \
149+
--set kuma.controlPlane.zone=zone-1 \
150+
--set kuma.ingress.enabled=true \
151+
--set kuma.controlPlane.kdsGlobalAddress=grpcs://$EXTERNAL_IP:5685 \
152+
--set kuma.controlPlane.tls.kdsZoneClient.skipVerify=true \
153+
kong-mesh kong-mesh/kong-mesh
154+
```
155+
156+
## Validate
157+
158+
1. To validate the federation, start by port-forwarding the API service from the global control plane to port 15681 to avoid collision with previous port-forward:
159+
160+
```sh
161+
kubectl --context mesh-global port-forward svc/kong-mesh-control-plane -n kong-mesh-system 15681:5681
162+
```
163+
164+
1. In a browser, go to [http://127.0.0.1:15681/gui/](http://127.0.0.1:15681/gui/) to see the GUI.
165+
166+
You should see:
167+
168+
* A zone in list of zones
169+
* Policies, including the `MeshTrafficPermission` that we applied in the [prerequisites](#install-kong-mesh-with-demo-configuration)
170+
* Data plane proxies for the demo application that we installed in the [prerequisites](#install-kong-mesh-with-demo-configuration)
171+
172+
It can take some time for these to appear, if you don't see them immediately, wait a few minutes and try again.
173+
174+
1. Create the `kong-mesh-demo` namespace in the global control plane:
175+
176+
```sh
177+
kubectl --context mesh-global create namespace kong-mesh-demo
178+
```
179+
180+
1. Apply a policy on the global control plane:
181+
182+
```sh
183+
echo "apiVersion: kuma.io/v1alpha1
184+
kind: MeshCircuitBreaker
185+
metadata:
186+
name: demo-app-to-redis
187+
namespace: kong-mesh-demo
188+
labels:
189+
kuma.io/mesh: default
190+
spec:
191+
targetRef:
192+
kind: Dataplane
193+
labels:
194+
app: demo-app
195+
to:
196+
- targetRef:
197+
kind: MeshService
198+
name: kv
199+
default:
200+
connectionLimits:
201+
maxConnections: 2
202+
maxPendingRequests: 8
203+
maxRetries: 2
204+
maxRequests: 2" | kubectl --context mesh-global apply -f -
205+
```
206+
207+
1. Check that the policy is applied on the zone control plane:
208+
```sh
209+
kubectl get --context mesh-zone meshcircuitbreakers -A
210+
```
211+
212+
You should get the following result:
213+
```sh
214+
NAMESPACE NAME TARGETREF KIND TARGETREF NAME
215+
kong-mesh-system demo-app-to-redis-65xb45x2xfd5bf7f Dataplane
216+
kong-mesh-system mesh-circuit-breaker-all-default Mesh
217+
kong-mesh-system mesh-circuit-breaker-all-default-d6zfxc24v7449xfv Mesh
218+
```
219+
{:.no-copy-code}

app/_how-tos/restrict-permissions-to-selected-namespaces-on-kubernetes.md

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,7 @@ prereqs:
2323
- title: Helm
2424
include_content: prereqs/helm
2525
- title: A running Kubernetes cluster
26-
content: |
27-
This guide requires a running Kubernetes cluster. If you already have a Kubernetes cluster running, you can skip this step.
28-
It can be a cluster running locally, like Docker, or in a public cloud like AWS EKS, GCP GKE, etc.
29-
30-
For example, if you are using [minikube](https://minikube.sigs.k8s.io/docs/):
31-
```sh
32-
minikube start -p mesh-zone
33-
```
26+
include_content: prereqs/kubernetes/mesh-cluster
3427

3528
cleanup:
3629
inline:

app/_how-tos/use-mesh-cli.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,8 @@ tldr:
2222
a: "kumactl and kubectl can be used to communicate with the Mesh Control plane"
2323
prereqs:
2424
inline:
25-
- title: Download kumactl
26-
content: |
27-
Go to the [Kuma packages](https://cloudsmith.io/~kong/repos/kuma-binaries-release/packages/) page to download and extract the installation archive for your OS, or download and extract the latest release automatically (Linux or macOS):
28-
29-
```sh
30-
curl -L https://developer.konghq.com/mesh/installer.sh | VERSION={{site.data.mesh_latest.version}} sh -
31-
```
25+
- title: Install kumactl
26+
include_content: prereqs/tools/kumactl
3227
- title: Review {{site.mesh_product_name}} documentation
3328
content: Go to the [CLI reference](/mesh/cli/) to see what options you have on the command line.
3429

app/_includes/prereqs/kubernetes/mesh-quickstart.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,4 +216,4 @@
216216
kind: Dataplane
217217
labels:
218218
app: kv" | kubectl apply -f -
219-
```
219+
```

0 commit comments

Comments
 (0)