This cheat sheet contains common commands regarding Kerberos administration and troubleshooting.
$> klist
Ticket cache: FILE:/tmp/krb5cc_0
Default principal: kafka_producer/producer@TEST.CONFLUENT.IO
Valid starting Expires Service principal
05/23/18 08:56:59 05/24/18 08:56:59 krbtgt/TEST.CONFLUENT.IO@TEST.CONFLUENT.IO
$> kinit kafka/admin
Password for kafka/admin@TEST.CONFLUENT.IO:
$> kinit -k -t /var/lib/secret/kafka.key kafka/admin
$> klist -k -t /var/lib/secret/kafka.key
Keytab name: FILE:/var/lib/secret/kafka.key
KVNO Timestamp Principal
---- ----------------- --------------------------------------------------------
2 05/23/18 08:56:43 zookeeper/zookeeper.kerberos_default@TEST.CONFLUENT.IO
2 05/23/18 08:56:43 zookeeper/zookeeper.kerberos_default@TEST.CONFLUENT.IO
2 05/23/18 08:56:43 kafka/admin@TEST.CONFLUENT.IO
2 05/23/18 08:56:43 kafka/admin@TEST.CONFLUENT.IO
2 05/23/18 08:56:43 kafka/kafka.kerberos_default@TEST.CONFLUENT.IO
2 05/23/18 08:56:43 kafka/kafka.kerberos_default@TEST.CONFLUENT.IO
2 05/23/18 08:56:43 kafka/zookeeper@TEST.CONFLUENT.IO
2 05/23/18 08:56:43 kafka/zookeeper@TEST.CONFLUENT.IO
2 05/23/18 08:56:43 kafka_consumer/consumer@TEST.CONFLUENT.IO
2 05/23/18 08:56:43 kafka_consumer/consumer@TEST.CONFLUENT.IO
2 05/23/18 08:56:43 kafka_producer/producer@TEST.CONFLUENT.IO
2 05/23/18 08:56:43 kafka_producer/producer@TEST.CONFLUENT.IO
$> kdestroy
$> kadmin.local -w password -q "add_principal -pw my_password kafka/zookeeper@TEST.CONFLUENT.IO"
WARNING: no policy specified for test@TEST.CONFLUENT.IO; defaulting to no policy
Principal "kafka/zookeeper@TEST.CONFLUENT.IO" created
$> kadmin.local -w password -q "add_principal -randkey kafka/zookeeper@TEST.CONFLUENT.IO"
WARNING: no policy specified for test@TEST.CONFLUENT.IO; defaulting to no policy
Principal "kafka/zookeeper@TEST.CONFLUENT.IO" created
$> kadmin.local -w password -q "ktadd -k /var/lib/secret/kafka.key -glob kafka/*"
Entry for principal kafka/admin@TEST.CONFLUENT.IO with kvno 3, encryption type aes256-cts-hmac-sha1-96 added to keytab FILE:/etc/krb5.keytab.
Entry for principal kafka/admin@TEST.CONFLUENT.IO with kvno 3, encryption type aes128-cts-hmac-sha1-96 added to keytab FILE:/etc/krb5.keytab.
Entry for principal kafka/kafka.kerberos_default@TEST.CONFLUENT.IO with kvno 3, encryption type aes256-cts-hmac-sha1-96 added to keytab FILE:/etc/krb5.keytab.
Entry for principal kafka/kafka.kerberos_default@TEST.CONFLUENT.IO with kvno 3, encryption type aes128-cts-hmac-sha1-96 added to keytab FILE:/etc/krb5.keytab.
Entry for principal kafka/zookeeper@TEST.CONFLUENT.IO with kvno 3, encryption type aes256-cts-hmac-sha1-96 added to keytab FILE:/etc/krb5.keytab.
Entry for principal kafka/zookeeper@TEST.CONFLUENT.IO with kvno 3, encryption type aes128-cts-hmac-sha1-96 added to keytab FILE:/etc/krb5.keytab