// Module included in the following assemblies:
//
// deploying/assembly_deploy-kafka-connect.adoc

[id='deploying-kafka-connect-{context}']
= Deploying Kafka Connect

[role="_abstract"]
This procedure shows how to deploy a Kafka Connect cluster to your Kubernetes cluster using the Cluster Operator.

A Kafka Connect cluster deployment is implemented with a configurable number of nodes (also called _workers_) that distribute the workload of connectors as _tasks_, ensuring a scalable and reliable message flow.

The deployment uses a YAML file to provide the specification to create a `KafkaConnect` resource.

Strimzi provides xref:config-examples-{context}[example configuration files].
In this procedure, we use the following example file:

* `examples/connect/kafka-connect.yaml`

WARNING: When deploying multiple Kafka Connect clusters managed by the Cluster Operator, deploy each cluster into a separate namespace.
Deploying multiple clusters in the same namespace can lead to naming conflicts and resource collisions.

.Prerequisites

* Cluster Operator is deployed.
* Kafka cluster is running.
+
This procedure assumes that the Kafka cluster was deployed using Strimzi.

.Procedure


. Edit the deployment file to configure connection details (if required). 
+ 
In `examples/connect/kafka-connect.yaml`, add or update the following properties as needed: 
+
* `spec.bootstrapServers` to specify the Kafka bootstrap address.
* `spec.authentication` to specify the authentication type as `tls`, `scram-sha-256`, `scram-sha-512`, `plain`, or `oauth`. +
See the link:{BookURLConfiguring}#type-KafkaConnectSpec-schema-reference[`KafkaConnectSpec` schema properties^] for configuration details.
* `spec.tls.trustedCertificates` to configure the TLS certificate. +
Use `[]` (an empty array) to trust the default Java CAs, or specify secrets containing trusted certificates. +
See the link:{BookURLConfiguring}#con-common-configuration-trusted-certificates-reference[`trustedCertificates` properties^] for configuration details.

. Configure the deployment for multiple Kafka Connect clusters (if required).
+ 
If you plan to run more than one Kafka Connect cluster in the same environment, each instance must use unique internal topic names and a unique group ID.
+ 
Update the `spec.config` properties in `kafka-connect.yaml` to replace the default values.
+
See xref:con-config-kafka-connect-multiple-instances-{context}[Configuring multiple Kafka Connect clusters] for details.

. Deploy Kafka Connect to your Kubernetes cluster.
Use the `examples/connect/kafka-connect.yaml` file to deploy Kafka Connect.
+
[source,shell]
----
kubectl apply -f examples/connect/kafka-connect.yaml
----

. Check the status of the deployment:
+
[source,shell]
----
kubectl get pods -n <my_cluster_operator_namespace>
----
+
.Output shows the deployment name and readiness
[source,shell]
----
NAME                                 READY  STATUS   RESTARTS
my-connect-cluster-connect-<pod_id>  1/1    Running  0
----
+
In this example, `my-connect-cluster` is the name of the Kafka Connect cluster. 
A pod ID identifies each created pod. 
By default, the deployment creates a single Kafka Connect pod. 
`READY` shows the number of ready versus expected replicas. 
The deployment is successful when the `STATUS` is `Running`.

[role="_additional-resources"]
.Additional resources

xref:con-kafka-connect-config-str[Kafka Connect cluster configuration]
