Skip to content

Commit 2485e8e

Browse files
expand explanations for the get started guide (#3226)
1 parent 9ad1e45 commit 2485e8e

File tree

2 files changed

+51
-14
lines changed

2 files changed

+51
-14
lines changed

app/_how-tos/knep/get-started-with-event-gateway.md

Lines changed: 50 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ description: Use this tutorial to get started with {{site.event_gateway}}.
2222
tldr:
2323
q: How can I get started with {{site.event_gateway}}?
2424
a: |
25-
Get started with {{site.event_gateway}} by setting up a {{site.konnect_short_name}} control plane and data plane, then configuring a backend cluster, virtual cluster, listener, and policy with the {{site.event_gateway}} API.
25+
Get started with {{site.event_gateway}} by setting up a {{site.konnect_short_name}} control plane and data plane, then configuring a backend cluster, virtual cluster, listener, and policies with the {{site.event_gateway}} API.
2626
2727
{:.info}
2828
> **Note:**
2929
> This quickstart runs a pre-configured demo Docker container to explore {{ site.base_gateway }}'s capabilities.
30-
If you want to run {{ site.base_gateway }} as a part of a production-ready platform, start with the [Install](/event-gateway/#install) page.
30+
If you want to run {{ site.base_gateway }} as a part of a production-ready platform, set up your control plane and data planes through the [{{site.konnect_short_name}} UI](/event-gateway/?tab=konnect-ui#install-event-gateway), or using [Terraform](/terraform/).
3131
3232
tools:
3333
- konnect-api
@@ -65,7 +65,7 @@ faqs:
6565
* Ensure that `acl_mode` is set to `passthrough` in the virtual cluster. If set to `enforce_on_gateway`, you won't see any topics listed without an ACL policy.
6666
---
6767

68-
{{site.event_gateway}} lets you configure virtual clusters, which act as a proxy interface between the client and the Kafka cluster.
68+
{{site.event_gateway}} lets you configure virtual clusters, which act as a proxy interface between the Kafka client and the Kafka cluster.
6969
With virtual clusters, you can:
7070
* Apply transformations, filtering, and custom policies
7171
* Route messages based on specific rules to different Kafka clusters
@@ -92,11 +92,14 @@ Copy and paste this into your terminal to configure your session.
9292

9393
{:.info}
9494
> This quickstart script is meant for demo purposes only, therefore it runs locally with default parameters and a small number of exposed ports.
95-
If you want to run {{ site.base_gateway }} as a part of a production-ready platform, start with the [Install](/event-gateway/#install) page.
95+
If you want to run {{ site.base_gateway }} as a part of a production-ready platform, set up your control plane and data planes through the [{{site.konnect_short_name}} UI](/event-gateway/?tab=konnect-ui#install-event-gateway), or using [Terraform](/terraform/).
9696

9797
## Add a backend cluster
9898

99-
Run the following command to create a new backend cluster linked to the local Kafka server we created in the [prerequisites](#start-a-local-kafka-server):
99+
[Backend clusters](/event-gateway/entities/backend-cluster/) are abstractions of your real Kafka clusters, and they store connection and configuration details required for {{site.event_gateway}} to proxy traffic to Kafka.
100+
You need at least one backend cluster.
101+
102+
Run the following command to create a new backend cluster linked to the local Kafka server we created in the [prerequisites](#start-a-local-kafka-cluster):
100103
<!--vale off-->
101104
{% konnect_api_request %}
102105
url: /v1/event-gateways/$EVENT_GATEWAY_ID/backend-clusters
@@ -116,13 +119,25 @@ body:
116119
{% endkonnect_api_request %}
117120
<!--vale on-->
118121

122+
In this example configuration:
123+
* `bootstrap_servers`: Points the backend cluster to the three bootstrap servers that we launched in the prerequisites.
124+
* `authentication` and `insecure_allow_anonymous_virtual_cluster_auth`: For demo purposes, we're allowing insecure `anonymous` connections, which means no authentication required.
125+
* `tls`: TLS is disabled so that we can easily test the connection.
126+
119127
Export the backend cluster ID to your environment:
120128
```sh
121129
export BACKEND_CLUSTER_ID="YOUR-BACKEND-CLUSTER-ID"
122130
```
123131

124132
## Add a virtual cluster
125133

134+
[Virtual clusters](/event-gateway/entities/virtual-cluster/) are the connection point for Kafka clients.
135+
Instead of connecting clients directly to your Kafka cluster, you can set up virtual clusters to customize how clients connect, and what requirements they need to have.
136+
From the client's point of view, they're just connecting to a regular Kafka cluster.
137+
138+
Virtual clusters provide environment isolation and let you enforce policies, manage authentication, and more.
139+
Each virtual cluster can connect to one backend cluster, though a backend cluster can have many virtual clusters connected to it.
140+
126141
Run the following command to create a new virtual cluster associated with our backend cluster:
127142
<!--vale off-->
128143
{% konnect_api_request %}
@@ -140,13 +155,22 @@ body:
140155
{% endkonnect_api_request %}
141156
<!--vale on-->
142157

158+
In this example:
159+
* `authentication`: Allows anonymous authentication.
160+
* `acl_mode`: The setting `passthrough` means that all clients are allowed and don't have to match a defined ACL.
161+
In a production environment, you would set this to `enforce_on_gateway` and define an ACL policy.
162+
* `name` is an internal name for the configuration object, while the `dns_label` is necessary for SNI routing.
163+
143164
Export the virtual cluster ID to your environment:
144165
```sh
145166
export VIRTUAL_CLUSTER_ID="YOUR-VIRTUAL-CLUSTER-ID"
146167
```
147168

148169
## Add a listener
149170

171+
A [listener](/event-gateway/entities/listener/) represents hostname-port or IP-port combinations that connect to TCP sockets.
172+
In this example, we're going to use port mapping, so we need to expose a range of ports.
173+
150174
Run the following command to create a new listener:
151175
<!--vale off-->
152176
{% konnect_api_request %}
@@ -169,7 +193,11 @@ export LISTENER_ID="YOUR-LISTENER-ID"
169193

170194
## Add a listener policy
171195

172-
Run the following command to add a listener policy that forwards messages to our virtual cluster:
196+
The listener needs a policy to tell it how to process requests and what to do with them.
197+
In this example, we're going to use the [Forward to Virtual Cluster](/event-gateway/policies/forward-to-virtual-cluster/) policy,
198+
which will forward requests based on a defined mapping to our virtual cluster.
199+
200+
Run the following command to add the listener policy:
173201

174202
<!--vale off-->
175203
{% konnect_api_request %}
@@ -187,10 +215,14 @@ body:
187215
{% endkonnect_api_request %}
188216
<!--vale on-->
189217

218+
For demo purposes, we're using port mapping, which assigns each Kafka broker to a dedicated port on the {{site.event_gateway_short}}.
219+
In production, we recommend using [SNI routing](/event-gateway/architecture/#hostname-mapping) instead.
190220

191221
## Add a virtual cluster policy
192222

193-
Run the following command to add a consume policy that adds a new header on the virtual cluster:
223+
Now, let's add a policy the virtual cluster so we can test our proxy.
224+
For this example, let's add a [Modify Headers](/event-gateway/policies/modify-headers/) policy, which lets you set or remove headers on requests:
225+
194226
<!--vale off-->
195227
{% konnect_api_request %}
196228
url: /v1/event-gateways/$EVENT_GATEWAY_ID/virtual-clusters/$VIRTUAL_CLUSTER_ID/consume-policies
@@ -207,9 +239,13 @@ body:
207239
{% endkonnect_api_request %}
208240
<!--vale on-->
209241

242+
This policy configuration sets the custom header `My-New-Header: header_value` on all requests proxied by this virtual cluster.
243+
210244
## Configure the Kafka cluster
211245

212-
Set up the `kafkactl` config file for your Kafka cluster:
246+
Now that we've configured the proxy, let's make sure the Kafka cluster is ready.
247+
248+
In your local environment, set up the `kafkactl.yaml` config file for your Kafka cluster:
213249

214250
```shell
215251
cat <<EOF > kafkactl.yaml
@@ -224,7 +260,12 @@ contexts:
224260
- localhost:19092
225261
EOF
226262
```
227-
This file defines two configuration profiles. We're going to switch between these profiles as we test different features.
263+
This file defines two configuration profiles:
264+
* `direct`: Connection addresses to all of the bootstrap servers you launched in the prerequisites, and configured in the backend cluster.
265+
Accessing the `direct` context will bypass the {{site.event_gateway}} proxy and connect directly to your Kafka cluster.
266+
* `vc`: Connection to the virtual cluster. Accessing the `vc` context will pass requests through the virtual cluster.
267+
268+
We're going to switch between these profiles as we test different features.
228269

229270
## Validate the cluster
230271

app/event-gateway/entities/virtual-cluster.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ breadcrumbs:
4040

4141
## What is a virtual cluster?
4242

43-
Virtual clusters are the primary way clients interact with the {{site.event_gateway_short}} proxy.q
43+
Virtual clusters are the primary way clients interact with the {{site.event_gateway_short}} proxy.
4444
They allow you to isolate clients from each other when connecting to the same [backend cluster](/event-gateway/entities/backend-cluster/),
4545
and provide each client with modified view while still appearing as a standard Kafka cluster.
4646

@@ -110,10 +110,6 @@ You will need to increase the number of virtual clusters if you want to create m
110110

111111
Here are some common patterns:
112112

113-
* **Environment isolation**: You can create isolated `dev`, `test`, and `prod` namespaces on top of the same physical Kafka cluster.
114-
If you have a topic named `orders` in each virtual cluster, this will map transparently to different backend topics: `dev-orders`, `test-orders`, and `prod-orders`.
115-
This provides isolation and automatic name resolution per environment.
116-
117113
* **Environment isolation**: You can create isolated `dev`, `test`, and `prod` namespaces on top of the same physical Kafka cluster.
118114
If you have a topic named `orders` in each virtual cluster, this will map transparently to different backend topics: `dev-orders`, `test-orders`, and `prod-orders`.
119115
This provides isolation and automatic name resolution per environment.

0 commit comments

Comments
 (0)