// Module included in the following assemblies:
//
// assembly-configuring-kafka-listeners.adoc

[id='proc-kafka-authentication-{context}']
= Configuring authentication in Kafka brokers

.Prerequisites

* A Kubernetes cluster is available.
* The Cluster Operator is running.

.Procedure

. Open the YAML configuration file that contains the `Kafka` resource specifying the cluster deployment.

. In the `spec.kafka.listeners` property in the `Kafka` resource, add the `authentication` field to the listeners for which you want to enable authentication.
For example:
+
[source,yaml,subs=attributes+]
----
apiVersion: {KafkaApiVersion}
kind: Kafka
spec:
  kafka:
    # ...
    listeners:
      tls:
        authentication:
          type: tls
    # ...
  zookeeper:
    # ...
----

. Apply the new configuration to create or update the resource.
+
Use `kubectl apply`:
[source,shell,subs=+quotes]
kubectl apply -f _kafka.yaml_
+
where `_kafka.yaml_` is the YAML configuration file for the resource that you want to configure; for example, `kafka-persistent.yaml`.

.Additional resources
* For more information about the supported authentication mechanisms, see xref:ref-kafka-authentication-{context}[authentication reference].
* For more information about the schema for `Kafka`, see xref:type-Kafka-reference[`Kafka` schema reference].
