// file included in the following:
//
// kroxylicious-operator/assemblies/assembly-operator-deploy-a-proxy.adoc

[id='con-configuring-virtualkafkacluster-{context}']
= Virtual cluster configuration for in-cluster access without TLS

A `VirtualKafkaCluster` resource defines a logical Kafka cluster that is accessible to clients over the network.

The virtual cluster references the following:

* A `KafkaProxy` resource that the proxy is associated with.
* One or more `KafkaProxyIngress` resources that expose the virtual cluster to Kafka clients.
* A `KafkaService` resource that defined the backend Kafka cluster.
* Zero or more `KafkaProtocolFilter` resources that apply filters to the Kafka protocol traffic passing between clients and the backend Kafka cluster.

This example shows a `VirtualKafkaCluster`, exposing it to Kafka clients running on the same Kubernetes cluster.
It uses plain TCP (as opposed to TLS) as the transport protocol.

.Example `VirtualKafkaCluster` configuration
[source,yaml]
----
kind: VirtualKafkaCluster
apiVersion: kroxylicious.io/v1alpha1
metadata:
  name: my-cluster
  namespace: my-proxy
spec:
  proxyRef: # <1>
    name: simple
  targetKafkaServiceRef: # <2>
    name: my-cluster
  ingresses:
    - ingressRef: # <3>
        name: cluster-ip
----
<1> The `proxyRef` names the `KafkaProxy` hosting with this virtual cluster.
  It must be in the same namespace as the `VirtualKafkaCluster`.
<2> The `KafkaService` that is proxied by the virtual cluster.
  It must be in the same namespace as the `VirtualKafkaCluster`.
<3> Ingresses to expose the virtual cluster.
  Each ingress names a `KafkaProxyIngress` which must be in the same namespace as the `VirtualKafkaCluster`.

// Let's look at what the referenced `KafkaProxyIngress` would look like.
//
// .Example `KafkaProxyIngress` configuration.
// [source,yaml]
// ----
// kind: KafkaProxyIngress
// apiVersion: kroxylicious.io/v1alpha1
// metadata:
//   name: cluster-ip
//   namespace: my-proxy
// spec:
//   proxyRef: # <1>
//     name: simple
//   clusterIP: # <2>
//     protocol: TCP # <3>
// ----
// <1> The ingress needs to refer to the same `KafkaProxy` resource as the `VirtualKafkaCluster`.
// <2> We use `clusterIP` for on-Kubernetes access.
// <3> The ingress uses `TCP` as the transport protocol.