Skip to content

Commit 5ed962c

Browse files
committed
document how to deploy with a LoadBalancer ingress
We need to instruct users on how to enable off-cluster access via SNI. We are intentionally vague about certificate generation and external DNS management as these will vary by environment. Signed-off-by: Robert Young <[email protected]>
1 parent e203237 commit 5ed962c

7 files changed

+180
-5
lines changed

docs/assemblies/assembly-operator-deploy-a-proxy-with-in-cluster-plain-ingress.adoc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
[id='assembly-operator-deploy-a-proxy-with-in-cluster-plain-ingress-{context}']
77
= Deploying a proxy exposed to Kafka clients on the same Kubernetes Cluster
8+
:parent-context: {context}
9+
:context: {parent-context}-in-cluster
810

911
[role="_abstract"]
1012
Deploy a basic proxy instance with a single virtual cluster exposed to Kafka clients on the same Kubernetes cluster.
@@ -36,4 +38,6 @@ include::assembly-operator-configuring-kafkaprotocolfilters.adoc[leveloffset=+3]
3638
// TODO
3739
// == Configuring a filter
3840
//
39-
// include::../modules/configuring/proc-configuring-filter.adoc[leveloffset=+1]
41+
// include::../modules/configuring/proc-configuring-filter.adoc[leveloffset=+1]
42+
43+
ifdef::parent-context[:context: {parent-context}]
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
// file included in the following:
2+
//
3+
// assembly-operator-deploy-a-proxy.adoc
4+
5+
6+
[id='assembly-operator-deploy-a-proxy-with-loadbalancer-ingress-{context}']
7+
= Deploying a proxy exposed to Kafka clients outside the Kubernetes Cluster via a LoadBalancer Service
8+
:parent-context: {context}
9+
:context: {parent-context}-load-balancer
10+
11+
[role="_abstract"]
12+
Deploy a basic proxy instance with a single virtual cluster exposed to Kafka clients outside the Kubernetes Cluster via a Kubernetes LoadBalancer Service.
13+
14+
== Prerequisites
15+
16+
* The operator must be installed in the Kubernetes cluster
17+
* A Kafka cluster to be proxied
18+
* External DNS under your control
19+
* <<Addressing Scheme>>
20+
* <<TLS Certificates for the proxy>>
21+
22+
=== Addressing Scheme
23+
24+
Access to a proxy from outside the Kubernetes Cluster via a LoadBalancer service requires:
25+
26+
* TLS between the client and proxy
27+
* Specific hostnames to be routed from the client to the LoadBalancer Service (configuring external DNS systems to do this is a user responsibility)
28+
29+
First we must decide on what addresses clients will use to address our virtual Kafka cluster:
30+
31+
* We choose a bootstrap address of `bootstrap.my-cluster.my-proxy.kroxylicious.io`
32+
* We choose broker addresses:
33+
** `broker-0.my-cluster.my-proxy.kroxylicious.io`
34+
** `broker-1.my-cluster.my-proxy.kroxylicious.io`
35+
** `broker-2.my-cluster.my-proxy.kroxylicious.io`
36+
37+
Where 0, 1 and 2 are the node ids of the proxied brokers.
38+
39+
Later we will configure our DNS to resolve these addresses to the manifested LoadBalancer Service.
40+
41+
=== TLS Certificates for the proxy
42+
43+
We must provision a Kubernetes Secret of type `kubernetes.io/tls` containing a server certificate with Subject Alternate Names containing all the names in our <<Addressing Scheme>>.
44+
45+
This Secret could be provisioned with a technology like https://cert-manager.io/[cert-manager].
46+
47+
For the purposes of this guide we will assume that a Secret named `proxy-server-tls` has been created in the `my-proxy`
48+
namespace (must be in the same namespace as the KafkaProxy)
49+
50+
== The required resources
51+
52+
include::../modules/configuring/con-kafkaproxy.adoc[leveloffset=+2]
53+
54+
include::../modules/configuring/con-kafkaproxyingress-for-loadbalancer-access.adoc[leveloffset=+2]
55+
56+
include::../modules/configuring/con-kafkaservice-by-bootstrap.adoc[leveloffset=+2]
57+
58+
include::../modules/configuring/con-virtualkafkacluster-tls.adoc[leveloffset=+2]
59+
// TODO
60+
// == Deploying the example proxy
61+
//
62+
// include::../modules/configuring/proc-deploying-example-proxy.adoc[leveloffset=+1]
63+
//
64+
65+
// configuring filters
66+
include::assembly-operator-configuring-kafkaprotocolfilters.adoc[leveloffset=+3]
67+
68+
// TODO
69+
// == Configuring a filter
70+
//
71+
// include::../modules/configuring/proc-configuring-filter.adoc[leveloffset=+1]
72+
73+
== DNS Configuration
74+
75+
After the Proxy has manifested we must configure our external DNS to resolve all the addresses in our <<Addressing Scheme>>
76+
to resolve to the LoadBalancer address.
77+
78+
A Kubernetes Service `simple-sni` should have been manifested, inspect it to obtain its external address. Depending on your environment,
79+
this may be an IP address, or a hostname.
80+
81+
Configure your DNS such that all the addresses in the <<Addressing Scheme>> either:
82+
83+
* resolve to the external IP address
84+
* resolve to the external hostname via a `CNAME` record
85+
86+
Once this is configured and the client can resolve all those addresses, you should be able to connect to the bootstrap
87+
address which is present in the `status.ingresses` section of the `VirtualKafkaCluster` you have created. The client will
88+
need to be appropriately configured to connect using TLS and trust the Server certificates.
89+
ifdef::parent-context[:context: {parent-context}]

docs/assemblies/assembly-operator-deploy-a-proxy.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55

66
[id='assembly-operator-deploying-a-proxy-{context}']
77
= Deploying a proxy
8-
98
[role="_abstract"]
109
This section provides a series of guides for deploying a proxy. We will explore different patterns for accessing the proxy.
1110

12-
include::assembly-operator-deploy-a-proxy-with-in-cluster-plain-ingress.adoc[leveloffset=+1]
11+
include::assembly-operator-deploy-a-proxy-with-in-cluster-plain-ingress.adoc[leveloffset=+1]
12+
include::assembly-operator-deploy-a-proxy-with-loadbalancer-ingress.adoc[leveloffset=+1]
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// file included in the following:
2+
//
3+
// kroxylicious-operator/assemblies/assembly-operator-deploy-a-proxy.adoc
4+
5+
[id='con-configuring-kafkaproxyingress-loadbalancer-access-{context}']
6+
= Networking configuration for external access via LoadBalancer Service
7+
8+
A `KafkaProxyIngress` resource defines the networking configuration that allows Kafka clients to connect to a `VirtualKafkaCluster`.
9+
10+
It is uniquely associated with a single `KafkaProxy` instance, but it is not uniquely associated with a `VirtualKafkaCluster`; it can be used by multiple `VirtualKafkaCluster` instances.
11+
12+
This example shows a `KafkaProxyIngress` for exposing virtual clusters to Kafka clients outside that Kubernetes Cluster, via a Kubernetes LoadBalancer Service.
13+
14+
.Example `KafkaProxyIngress` configuration for LoadBalancer access.
15+
[source,yaml]
16+
----
17+
kind: KafkaProxyIngress
18+
apiVersion: kroxylicious.io/v1alpha1
19+
metadata:
20+
namespace: my-proxy
21+
name: load-balancer
22+
spec:
23+
proxyRef: # <1>
24+
name: simple
25+
loadBalancer: # <2>
26+
bootstrapAddress: 'bootstrap.$(virtualClusterName).my-proxy.kroxylicious.io' # <3>
27+
advertisedBrokerAddressPattern: 'broker-$(nodeId).$(virtualClusterName).my-proxy.kroxylicious.io' # <4>
28+
----
29+
<1> The `proxyRef` names the `KafkaProxy` resource that this ingress is part of. It must be in the same namespace as the `KafkaProxyIngress`.
30+
<2> This ingress uses `loadBalancer` networking, which connects a Kubernetes `Service` resources with `type: LoadBalancer` to the virtual cluster (this Service may be shared with other clusters).
31+
<3> The bootstrap address that clients will bootstrap with. Using the optional `$(virtualClusterName)` replacement allows this `KafkaProxyIngress` to be referenced by multiple `VirtualKafkaCluster` resources
32+
<4> The advertised broker address pattern that clients will connect to when communicating with brokers. Using the optional `$(virtualClusterName)` replacement allows this `KafkaProxyIngress` to be referenced by multiple `VirtualKafkaCluster` resources
33+
34+
NOTE: LoadBalancer ingress requires TLS between the client and Proxy. So each `VirtualKafkaCluster` that references this `KafkaProxyIngress`
35+
must have `tls` configured alongside the `KafkaProxyIngress` reference.

docs/modules/configuring/con-kafkaproxyingress-for-on-cluster-access.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ It is uniquely associated with a single `KafkaProxy` instance, but it is not uni
1111

1212
This example shows a `KafkaProxyIngress` for exposing virtual clusters to Kafka clients running in the same Kubernetes cluster as the proxy.
1313

14-
.Example `KafkaProxyIngress` configuration.
14+
.Example `KafkaProxyIngress` configuration for on cluster access.
1515
[source,yaml]
1616
----
1717
kind: KafkaProxyIngress

docs/modules/configuring/con-kafkaservice-by-bootstrap.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ spec:
2121
nodeIdRanges: # <2>
2222
- name: brokers # <3>
2323
start: 0 # <4>
24-
end: 5 # <5>
24+
end: 2 # <5>
2525
# ...
2626
----
2727
<1> The `bootstrapServers` property is a comma-separated list of addresses in `<host>:<port>` format. Including multiple broker addresses helps clients connect when one is unavailable.
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
// file included in the following:
2+
//
3+
// kroxylicious-operator/assemblies/assembly-operator-deploy-a-proxy.adoc
4+
5+
[id='con-configuring-virtualkafkacluster-{context}']
6+
= Virtual cluster configuration for LoadBalancer access with TLS
7+
8+
A `VirtualKafkaCluster` resource defines a logical Kafka cluster that is accessible to clients over the network.
9+
10+
The virtual cluster references the following:
11+
12+
* A `KafkaProxy` resource that the proxy is associated with.
13+
* One or more `KafkaProxyIngress` resources that expose the virtual cluster to Kafka clients.
14+
* A `KafkaService` resource that defined the backend Kafka cluster.
15+
* Zero or more `KafkaProtocolFilter` resources that apply filters to the Kafka protocol traffic passing between clients and the backend Kafka cluster.
16+
17+
This example shows a `VirtualKafkaCluster`, exposing it to external Kafka clients via a LoadBalancer Service.
18+
It uses TLS as the transport protocol (LoadBalancer ingress requires TLS).
19+
20+
.Example `VirtualKafkaCluster` configuration with downstream TLS
21+
[source,yaml]
22+
----
23+
kind: VirtualKafkaCluster
24+
apiVersion: kroxylicious.io/v1alpha1
25+
metadata:
26+
name: my-cluster
27+
namespace: my-proxy
28+
spec:
29+
proxyRef: # <1>
30+
name: simple
31+
targetKafkaServiceRef: # <2>
32+
name: my-cluster
33+
ingresses:
34+
- ingressRef: # <3>
35+
name: load-balancer
36+
tls:
37+
certificateRef: # <4>
38+
name: 'proxy-server-tls'
39+
kind: Secret
40+
----
41+
<1> The `proxyRef` names the `KafkaProxy` hosting with this virtual cluster.
42+
It must be in the same namespace as the `VirtualKafkaCluster`.
43+
<2> The `KafkaService` that is proxied by the virtual cluster.
44+
It must be in the same namespace as the `VirtualKafkaCluster`.
45+
<3> Ingresses to expose the virtual cluster.
46+
Each ingress names a `KafkaProxyIngress` which must be in the same namespace as the `VirtualKafkaCluster`.
47+
<4> TLS server certificate that the Proxy will use to secure connections on this particular ingress. The `Secret` must be in the same namespace as the `VirtualKafkaCluster`

0 commit comments

Comments
 (0)