CDK 2.0 and higher Powered By Apache Kafka supports Kerberos authentication, but it is supported only for the new Kafka Producer and Consumer APIs. If you already have a Kerberos server, you can add Kafka to your current configuration. If you do not have a Kerberos server, install it before proceeding. See Enabling Kerberos Authentication Using the Wizard.html
If you already have configured the mapping from Kerberos principals to short names using the hadoop.security.auth_to_local HDFS configuration property, configure the same rules for Kafka by adding the sasl.kerberos.principal.to.local.rules property to the Advanced Configuration Snippet for Kafka Broker Advanced Configuration Snippet using Cloudera Manager. Specify the rules as a comma separated list.java
To enable Kerberos authentication for Kafka:bootstrap
If you use kinit first, use this configuration.app
KafkaClient { com.sun.security.auth.module.Krb5LoginModule required useTicketCache=true; };
KafkaClient { com.sun.security.auth.module.Krb5LoginModule required useKeyTab=true keyTab="/etc/security/keytabs/kafka_server.keytab" principal="kafka/kafka1.hostname.com@EXAMPLE.COM"; };
security.protocol=SASL_PLAINTEXT sasl.kerberos.service.name=kafka
$ kinit <user>
$ kafka-topics --list --zookeeper <zkhost>:2181
$ export KAFKA_OPTS="-Djava.security.auth.login.config=/home/user/jaas.conf"
$ kafka-console-producer --broker-list <anybroker>:9092 --topic test1 --producer.config client.properties
$ kafka-console-consumer --new-consumer --topic test1 --from-beginning --bootstrap-server <anybroker>:9092 --consumer.config client.properties