// Module included in the following assemblies:
//
// assembly-deploy-kafka-connect-with-plugins.adoc

[id='using-image-volumes-to-add-connector-plugins-{context}']
= Using Kubernetes Image Volumes to add connector plugins

[role="_abstract"]
Configure Kafka Connect so that connectors are automatically mounted as link:https://kubernetes.io/docs/concepts/storage/volumes/#image[Kubernetes Image Volumes^].
You define the connector plugins using the `.spec.plugins` property of the `KafkaConnect` custom resource.
Strimzi automatically mounts them into the Kafka Connect deployment.

IMPORTANT: This feature requires that the Kubernetes Image Volume feature is enabled and supported by your Kubernetes cluster.

.Prerequisites

* xref:deploying-cluster-operator-str[The Cluster Operator must be deployed.]
* Your connector plugins must be available in your container registry as container images (OCI artifacts).

.Procedure

. Configure the `KafkaConnect` custom resource by specifying the additional connector plugins in`.spec.plugins`:
+
[source,yaml,subs=attributes+,options="nowrap"]
----
apiVersion: {KafkaConnectApiVersion}
kind: KafkaConnect
metadata:
  name: my-connect-cluster
spec: # <1>
  #...
  plugins: # <2>
    - name: connector-1
      artifacts:
        - type: image
          reference: <reference_to_container_image_or_OCI_artifact>
          pullPolicy: <pull_policy>
    - name: connector-2
      artifacts:
        - type: image
          reference: <reference_to_container_image_or_OCI_artifact>
          pullPolicy: <pull_policy>
  #...
----
<1> link:{BookURLConfiguring}#type-KafkaConnectSpec-reference[The specification for the Kafka Connect cluster^].
<2> (Required) List of connector plugins and their artifacts to mount in the Kafka Connect deployment. Each plugin must be configured with at least one `artifact`.

. Create or update the resource:
+
[source,subs="+quotes"]
----
$ kubectl apply -f <kafka_connect_configuration_file>
----

. Wait for the Kafka Connect cluster to be deployed.

. Use the Kafka Connect REST API or `KafkaConnector` custom resources to configure and run connectors based on the plugins you added.

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

* link:{BookURLConfiguring}#type-MountedPlugin-reference[Kafka Connect `plugins` schema reference^]
