Skip to content

Compare Kafka ACLs between two clusters

Every part of an ACL can differ. Here is how each difference shows up.

Terminal recording of kurkik kafka diff

The recording shows kurkik kafka diff on the demo sandbox; its data differs from this example.

Shown here: one broker. Other broker setups are further down.

Terminal window
kurkik kafka diff a b --acls
a vs b
cluster MkU3OEVBNTcwNTJENDM2Qk
ACLs
~ User:analytics permission - User:analytics READ on TOPIC customers.updated: ALLOW on a, DENY on b.
! User:audit - a has ALLOW User:audit DESCRIBE on TOPIC orders.created; b does not.
+ User:auditor - b has ALLOW User:auditor DESCRIBE on TOPIC orders.created; a does not.
+ User:billing - b has ALLOW User:billing READ on TOPIC customers.updated; a does not.
! User:billing - a has ALLOW User:billing READ on TOPIC payments.settled; b does not.
+ User:ops - b has ALLOW User:ops WRITE on TOPIC orders.created; a does not.
! User:ops - a has ALLOW User:ops WRITE on TOPIC orders.created from 10.0.0.1; b does not.
+ User:orders-service - b has ALLOW User:orders-service WRITE on TOPIC orders.; a does not.
! User:orders-service - a has ALLOW User:orders-service WRITE on TOPIC prefix orders.; b does not.
+ User:reporting - b has ALLOW User:reporting DESCRIBE on GROUP reporting; a does not.
! User:reporting - a has ALLOW User:reporting READ on GROUP reporting; b does not.
Notes
- Not compared: groups, schemas, configuration. Add --groups --schemas --configs, or --all, to compare them.
Drift: 1 changed · 5 unmanaged · 5 missing (drift) - 14 matched

Exit code 2: drift found, so a CI job can stop here.

Mark Means
~ both sides have it, but it differs
! only the first side has it
+ only the second side has it
Compare Command Result
two clusters kurkik kafka diff a b --acls Drift: 1 changed · 5 unmanaged · 5 missing (drift) - 14 matched
a document and a cluster kurkik kafka diff a.yaml b --acls Drift: 1 changed · 5 unmanaged · 5 missing (drift) - 14 matched
two documents kurkik kafka diff a.yaml b.yaml --acls Drift: 1 changed · 5 unmanaged · 5 missing (drift) - 14 matched

Download the JSON report (-o json)

a.yaml, 204 lines
asyncapi: 3.0.0
info:
title: a Apache Kafka API
version: 1.0.0-SNAPSHOT
description: "Generated by reading the a cluster. Cluster id: MkU3OEVBNTcwNTJENDM2Qk."
servers:
broker-1:
host: a-kafka-1:9092
protocol: kafka
protocolVersion: "4.4"
x-kurkik:
kafka:
server:
security:
- security: PLAINTEXT
securityProtocol: PLAINTEXT
acl:
- principal: User:reporting
host: '*'
operation: READ
permission: ALLOW
resourceType: GROUP
patternType: LITERAL
name: reporting
- principal: User:analytics
host: '*'
operation: READ
permission: ALLOW
resourceType: TOPIC
patternType: LITERAL
name: customers.updated
- principal: User:audit
host: '*'
operation: DESCRIBE
permission: ALLOW
resourceType: TOPIC
patternType: LITERAL
name: orders.created
- principal: User:billing
host: '*'
operation: READ
permission: ALLOW
resourceType: TOPIC
patternType: LITERAL
name: orders.created
- principal: User:ops
host: 10.0.0.1
operation: WRITE
permission: ALLOW
resourceType: TOPIC
patternType: LITERAL
name: orders.created
- principal: User:billing
host: '*'
operation: READ
permission: ALLOW
resourceType: TOPIC
patternType: LITERAL
name: payments.settled
- principal: User:orders-service
host: '*'
operation: WRITE
permission: ALLOW
resourceType: TOPIC
patternType: PREFIXED
name: orders.
groups: []
brokerConfiguration:
advertised.listeners: "INTERNAL://kafka-1:19092,EXTERNAL://a-kafka-1:9092"
authorizer.class.name: org.apache.kafka.metadata.authorizer.StandardAuthorizer
broker.id: "1"
controller.listener.names: CONTROLLER
controller.quorum.voters: 1@kafka-1:9093
group.initial.rebalance.delay.ms: "0"
inter.broker.listener.name: INTERNAL
listener.security.protocol.map: "INTERNAL:PLAINTEXT,EXTERNAL:PLAINTEXT,CONTROLLER:PLAINTEXT"
listeners: "INTERNAL://0.0.0.0:19092,EXTERNAL://0.0.0.0:9092,CONTROLLER://0.0.0.0:9093"
min.insync.replicas: "1"
node.id: "1"
offsets.topic.replication.factor: "1"
process.roles: "broker,controller"
transaction.state.log.min.isr: "1"
transaction.state.log.replication.factor: "1"
clientConfiguration:
bootstrap.servers: a-kafka-1:9092
security.protocol: PLAINTEXT
groupConfiguration: {}
producerConfiguration: {}
consumerConfiguration: {}
channels:
customers.updated:
address: customers.updated
bindings:
kafka:
bindingVersion: 0.5.0
partitions: 3
replicas: 1
topicConfiguration:
cleanup.policy:
- compact
x-kurkik:
kafka:
channel:
topic: customers.updated
partitions: 3
replicas: 1
topicConfiguration:
cleanup.policy: compact
orders.created:
address: orders.created
bindings:
kafka:
bindingVersion: 0.5.0
partitions: 3
replicas: 1
topicConfiguration:
retention.ms: 604800000
x-kurkik:
kafka:
channel:
topic: orders.created
partitions: 3
replicas: 1
topicConfiguration:
retention.ms: "604800000"
payments.settled:
address: payments.settled
bindings:
kafka:
bindingVersion: 0.5.0
partitions: 3
replicas: 1
x-kurkik:
kafka:
channel:
topic: payments.settled
partitions: 3
replicas: 1
topicConfiguration:
min.insync.replicas: "1"
retention.bytes: "10737418240"
operations:
receive_customers.updated:
action: receive
channel:
$ref: "#/channels/customers.updated"
x-kurkik:
kafka:
operation:
security:
- User:analytics
consumerConfiguration: {}
groupConfiguration: {}
receive_orders.created:
action: receive
channel:
$ref: "#/channels/orders.created"
x-kurkik:
kafka:
operation:
security:
- User:billing
consumerConfiguration: {}
groupConfiguration: {}
receive_payments.settled:
action: receive
channel:
$ref: "#/channels/payments.settled"
x-kurkik:
kafka:
operation:
security:
- User:billing
consumerConfiguration: {}
groupConfiguration: {}
send_customers.updated:
action: send
channel:
$ref: "#/channels/customers.updated"
x-kurkik:
kafka:
operation:
security: []
producerConfiguration: {}
send_orders.created:
action: send
channel:
$ref: "#/channels/orders.created"
x-kurkik:
kafka:
operation:
security:
- User:ops
- User:orders-service
producerConfiguration: {}
send_payments.settled:
action: send
channel:
$ref: "#/channels/payments.settled"
x-kurkik:
kafka:
operation:
security: []
producerConfiguration: {}

Download a.yaml

b.yaml, 202 lines
asyncapi: 3.0.0
info:
title: b Apache Kafka API
version: 1.0.0-SNAPSHOT
description: "Generated by reading the b cluster. Cluster id: MkU3OEVBNTcwNTJENDM2Qk."
servers:
broker-1:
host: b-kafka-1:9092
protocol: kafka
protocolVersion: "4.4"
x-kurkik:
kafka:
server:
security:
- security: PLAINTEXT
securityProtocol: PLAINTEXT
acl:
- principal: User:reporting
host: '*'
operation: DESCRIBE
permission: ALLOW
resourceType: GROUP
patternType: LITERAL
name: reporting
- principal: User:analytics
host: '*'
operation: READ
permission: DENY
resourceType: TOPIC
patternType: LITERAL
name: customers.updated
- principal: User:billing
host: '*'
operation: READ
permission: ALLOW
resourceType: TOPIC
patternType: LITERAL
name: customers.updated
- principal: User:orders-service
host: '*'
operation: WRITE
permission: ALLOW
resourceType: TOPIC
patternType: LITERAL
name: orders.
- principal: User:auditor
host: '*'
operation: DESCRIBE
permission: ALLOW
resourceType: TOPIC
patternType: LITERAL
name: orders.created
- principal: User:billing
host: '*'
operation: READ
permission: ALLOW
resourceType: TOPIC
patternType: LITERAL
name: orders.created
- principal: User:ops
host: '*'
operation: WRITE
permission: ALLOW
resourceType: TOPIC
patternType: LITERAL
name: orders.created
groups: []
brokerConfiguration:
advertised.listeners: "INTERNAL://kafka-1:19092,EXTERNAL://b-kafka-1:9092"
authorizer.class.name: org.apache.kafka.metadata.authorizer.StandardAuthorizer
broker.id: "1"
controller.listener.names: CONTROLLER
controller.quorum.voters: 1@kafka-1:9093
group.initial.rebalance.delay.ms: "0"
inter.broker.listener.name: INTERNAL
listener.security.protocol.map: "INTERNAL:PLAINTEXT,EXTERNAL:PLAINTEXT,CONTROLLER:PLAINTEXT"
listeners: "INTERNAL://0.0.0.0:19092,EXTERNAL://0.0.0.0:9092,CONTROLLER://0.0.0.0:9093"
min.insync.replicas: "1"
node.id: "1"
offsets.topic.replication.factor: "1"
process.roles: "broker,controller"
transaction.state.log.min.isr: "1"
transaction.state.log.replication.factor: "1"
clientConfiguration:
bootstrap.servers: b-kafka-1:9092
security.protocol: PLAINTEXT
groupConfiguration: {}
producerConfiguration: {}
consumerConfiguration: {}
channels:
customers.updated:
address: customers.updated
bindings:
kafka:
bindingVersion: 0.5.0
partitions: 3
replicas: 1
topicConfiguration:
cleanup.policy:
- compact
x-kurkik:
kafka:
channel:
topic: customers.updated
partitions: 3
replicas: 1
topicConfiguration:
cleanup.policy: compact
orders.created:
address: orders.created
bindings:
kafka:
bindingVersion: 0.5.0
partitions: 3
replicas: 1
topicConfiguration:
retention.ms: 604800000
x-kurkik:
kafka:
channel:
topic: orders.created
partitions: 3
replicas: 1
topicConfiguration:
retention.ms: "604800000"
payments.settled:
address: payments.settled
bindings:
kafka:
bindingVersion: 0.5.0
partitions: 3
replicas: 1
x-kurkik:
kafka:
channel:
topic: payments.settled
partitions: 3
replicas: 1
topicConfiguration:
min.insync.replicas: "1"
retention.bytes: "10737418240"
operations:
receive_customers.updated:
action: receive
channel:
$ref: "#/channels/customers.updated"
x-kurkik:
kafka:
operation:
security:
- User:billing
consumerConfiguration: {}
groupConfiguration: {}
receive_orders.created:
action: receive
channel:
$ref: "#/channels/orders.created"
x-kurkik:
kafka:
operation:
security:
- User:billing
consumerConfiguration: {}
groupConfiguration: {}
receive_payments.settled:
action: receive
channel:
$ref: "#/channels/payments.settled"
x-kurkik:
kafka:
operation:
security: []
consumerConfiguration: {}
groupConfiguration: {}
send_customers.updated:
action: send
channel:
$ref: "#/channels/customers.updated"
x-kurkik:
kafka:
operation:
security: []
producerConfiguration: {}
send_orders.created:
action: send
channel:
$ref: "#/channels/orders.created"
x-kurkik:
kafka:
operation:
security:
- User:ops
producerConfiguration: {}
send_payments.settled:
action: send
channel:
$ref: "#/channels/payments.settled"
x-kurkik:
kafka:
operation:
security: []
producerConfiguration: {}

Download b.yaml

How to build this setup yourself

Brokers

Cluster a

Terminal window
kafka-topics.sh --bootstrap-server a-kafka-1:9092 --create --topic orders.created --partitions 3 --replication-factor 1 --config retention.ms=604800000
kafka-topics.sh --bootstrap-server a-kafka-1:9092 --create --topic payments.settled --partitions 3 --replication-factor 1 --config min.insync.replicas=1 --config retention.bytes=10737418240
kafka-topics.sh --bootstrap-server a-kafka-1:9092 --create --topic customers.updated --partitions 3 --replication-factor 1 --config cleanup.policy=compact
kafka-acls.sh --bootstrap-server a-kafka-1:9092 --add --allow-principal User:billing --operation Read --topic orders.created
kafka-acls.sh --bootstrap-server a-kafka-1:9092 --add --allow-principal User:analytics --operation Read --topic customers.updated
kafka-acls.sh --bootstrap-server a-kafka-1:9092 --add --allow-principal User:audit --operation Describe --topic orders.created
kafka-acls.sh --bootstrap-server a-kafka-1:9092 --add --allow-principal User:billing --operation Read --topic payments.settled
kafka-acls.sh --bootstrap-server a-kafka-1:9092 --add --allow-principal User:ops --allow-host 10.0.0.1 --operation Write --topic orders.created
kafka-acls.sh --bootstrap-server a-kafka-1:9092 --add --allow-principal User:orders-service --operation Write --topic orders. --resource-pattern-type prefixed
kafka-acls.sh --bootstrap-server a-kafka-1:9092 --add --allow-principal User:reporting --operation Read --group reporting

Cluster b

Terminal window
kafka-topics.sh --bootstrap-server b-kafka-1:9092 --create --topic orders.created --partitions 3 --replication-factor 1 --config retention.ms=604800000
kafka-topics.sh --bootstrap-server b-kafka-1:9092 --create --topic payments.settled --partitions 3 --replication-factor 1 --config min.insync.replicas=1 --config retention.bytes=10737418240
kafka-topics.sh --bootstrap-server b-kafka-1:9092 --create --topic customers.updated --partitions 3 --replication-factor 1 --config cleanup.policy=compact
kafka-acls.sh --bootstrap-server b-kafka-1:9092 --add --allow-principal User:billing --operation Read --topic orders.created
kafka-acls.sh --bootstrap-server b-kafka-1:9092 --add --deny-principal User:analytics --operation Read --topic customers.updated
kafka-acls.sh --bootstrap-server b-kafka-1:9092 --add --allow-principal User:auditor --operation Describe --topic orders.created
kafka-acls.sh --bootstrap-server b-kafka-1:9092 --add --allow-principal User:billing --operation Read --topic customers.updated
kafka-acls.sh --bootstrap-server b-kafka-1:9092 --add --allow-principal User:ops --operation Write --topic orders.created
kafka-acls.sh --bootstrap-server b-kafka-1:9092 --add --allow-principal User:orders-service --operation Write --topic orders.
kafka-acls.sh --bootstrap-server b-kafka-1:9092 --add --allow-principal User:reporting --operation Describe --group reporting

Compare

Terminal window
kurkik conn add kafka a --bootstrap a-kafka-1:9092 --registry-url http://registry-a:8080 --registry-vendor apicurio
kurkik conn add kafka b --bootstrap b-kafka-1:9092 --registry-url http://registry-b:8080 --registry-vendor apicurio
kurkik kafka export a --acls --groups --stdout > a.yaml
kurkik kafka export b --acls --groups --stdout > b.yaml
kurkik kafka diff a b --acls # cluster-vs-cluster
kurkik kafka diff a.yaml b --acls # document-vs-cluster
kurkik kafka diff a.yaml b.yaml --acls # document-vs-document

Same output.

How to build this setup yourself

Brokers

Cluster a

Terminal window
kafka-topics.sh --bootstrap-server a-kafka-1:9092 --create --topic orders.created --partitions 3 --replication-factor 3 --config retention.ms=604800000
kafka-topics.sh --bootstrap-server a-kafka-1:9092 --create --topic payments.settled --partitions 3 --replication-factor 3 --config min.insync.replicas=1 --config retention.bytes=10737418240
kafka-topics.sh --bootstrap-server a-kafka-1:9092 --create --topic customers.updated --partitions 3 --replication-factor 3 --config cleanup.policy=compact
kafka-acls.sh --bootstrap-server a-kafka-1:9092 --add --allow-principal User:billing --operation Read --topic orders.created
kafka-acls.sh --bootstrap-server a-kafka-1:9092 --add --allow-principal User:analytics --operation Read --topic customers.updated
kafka-acls.sh --bootstrap-server a-kafka-1:9092 --add --allow-principal User:audit --operation Describe --topic orders.created
kafka-acls.sh --bootstrap-server a-kafka-1:9092 --add --allow-principal User:billing --operation Read --topic payments.settled
kafka-acls.sh --bootstrap-server a-kafka-1:9092 --add --allow-principal User:ops --allow-host 10.0.0.1 --operation Write --topic orders.created
kafka-acls.sh --bootstrap-server a-kafka-1:9092 --add --allow-principal User:orders-service --operation Write --topic orders. --resource-pattern-type prefixed
kafka-acls.sh --bootstrap-server a-kafka-1:9092 --add --allow-principal User:reporting --operation Read --group reporting

Cluster b

Terminal window
kafka-topics.sh --bootstrap-server b-kafka-1:9092 --create --topic orders.created --partitions 3 --replication-factor 3 --config retention.ms=604800000
kafka-topics.sh --bootstrap-server b-kafka-1:9092 --create --topic payments.settled --partitions 3 --replication-factor 3 --config min.insync.replicas=1 --config retention.bytes=10737418240
kafka-topics.sh --bootstrap-server b-kafka-1:9092 --create --topic customers.updated --partitions 3 --replication-factor 3 --config cleanup.policy=compact
kafka-acls.sh --bootstrap-server b-kafka-1:9092 --add --allow-principal User:billing --operation Read --topic orders.created
kafka-acls.sh --bootstrap-server b-kafka-1:9092 --add --deny-principal User:analytics --operation Read --topic customers.updated
kafka-acls.sh --bootstrap-server b-kafka-1:9092 --add --allow-principal User:auditor --operation Describe --topic orders.created
kafka-acls.sh --bootstrap-server b-kafka-1:9092 --add --allow-principal User:billing --operation Read --topic customers.updated
kafka-acls.sh --bootstrap-server b-kafka-1:9092 --add --allow-principal User:ops --operation Write --topic orders.created
kafka-acls.sh --bootstrap-server b-kafka-1:9092 --add --allow-principal User:orders-service --operation Write --topic orders.
kafka-acls.sh --bootstrap-server b-kafka-1:9092 --add --allow-principal User:reporting --operation Describe --group reporting

Compare

Terminal window
kurkik conn add kafka a --bootstrap a-kafka-1:9092,a-kafka-2:9092,a-kafka-3:9092 --registry-url http://registry-a:8080 --registry-vendor apicurio
kurkik conn add kafka b --bootstrap b-kafka-1:9092,b-kafka-2:9092,b-kafka-3:9092 --registry-url http://registry-b:8080 --registry-vendor apicurio
kurkik kafka export a --acls --groups --stdout > a.yaml
kurkik kafka export b --acls --groups --stdout > b.yaml
kurkik kafka diff a b --acls # cluster-vs-cluster
kurkik kafka diff a.yaml b --acls # document-vs-cluster
kurkik kafka diff a.yaml b.yaml --acls # document-vs-document

Same output.

How to build this setup yourself

Brokers

Cluster a

Terminal window
kafka-topics.sh --bootstrap-server a-kafka-1:9092 --create --topic orders.created --partitions 3 --replication-factor 3 --config retention.ms=604800000
kafka-topics.sh --bootstrap-server a-kafka-1:9092 --create --topic payments.settled --replica-assignment 2,2 --config min.insync.replicas=1 --config retention.bytes=10737418240
kafka-topics.sh --bootstrap-server a-kafka-1:9092 --create --topic customers.updated --replica-assignment 1:3 --config cleanup.policy=compact
kafka-acls.sh --bootstrap-server a-kafka-1:9092 --add --allow-principal User:billing --operation Read --topic orders.created
kafka-acls.sh --bootstrap-server a-kafka-1:9092 --add --allow-principal User:analytics --operation Read --topic customers.updated
kafka-acls.sh --bootstrap-server a-kafka-1:9092 --add --allow-principal User:audit --operation Describe --topic orders.created
kafka-acls.sh --bootstrap-server a-kafka-1:9092 --add --allow-principal User:billing --operation Read --topic payments.settled
kafka-acls.sh --bootstrap-server a-kafka-1:9092 --add --allow-principal User:ops --allow-host 10.0.0.1 --operation Write --topic orders.created
kafka-acls.sh --bootstrap-server a-kafka-1:9092 --add --allow-principal User:orders-service --operation Write --topic orders. --resource-pattern-type prefixed
kafka-acls.sh --bootstrap-server a-kafka-1:9092 --add --allow-principal User:reporting --operation Read --group reporting

Cluster b

Terminal window
kafka-topics.sh --bootstrap-server b-kafka-1:9092 --create --topic orders.created --partitions 3 --replication-factor 3 --config retention.ms=604800000
kafka-topics.sh --bootstrap-server b-kafka-1:9092 --create --topic payments.settled --replica-assignment 2,2 --config min.insync.replicas=1 --config retention.bytes=10737418240
kafka-topics.sh --bootstrap-server b-kafka-1:9092 --create --topic customers.updated --replica-assignment 1:3 --config cleanup.policy=compact
kafka-acls.sh --bootstrap-server b-kafka-1:9092 --add --allow-principal User:billing --operation Read --topic orders.created
kafka-acls.sh --bootstrap-server b-kafka-1:9092 --add --deny-principal User:analytics --operation Read --topic customers.updated
kafka-acls.sh --bootstrap-server b-kafka-1:9092 --add --allow-principal User:auditor --operation Describe --topic orders.created
kafka-acls.sh --bootstrap-server b-kafka-1:9092 --add --allow-principal User:billing --operation Read --topic customers.updated
kafka-acls.sh --bootstrap-server b-kafka-1:9092 --add --allow-principal User:ops --operation Write --topic orders.created
kafka-acls.sh --bootstrap-server b-kafka-1:9092 --add --allow-principal User:orders-service --operation Write --topic orders.
kafka-acls.sh --bootstrap-server b-kafka-1:9092 --add --allow-principal User:reporting --operation Describe --group reporting

Compare

Terminal window
kurkik conn add kafka a --bootstrap a-kafka-1:9092,a-kafka-2:9092,a-kafka-3:9092 --registry-url http://registry-a:8080 --registry-vendor apicurio
kurkik conn add kafka b --bootstrap b-kafka-1:9092,b-kafka-2:9092,b-kafka-3:9092 --registry-url http://registry-b:8080 --registry-vendor apicurio
kurkik kafka export a --acls --groups --stdout > a.yaml
kurkik kafka export b --acls --groups --stdout > b.yaml
kurkik kafka diff a b --acls # cluster-vs-cluster
kurkik kafka diff a.yaml b --acls # document-vs-cluster
kurkik kafka diff a.yaml b.yaml --acls # document-vs-document

All flags: kurkik kafka diff · more Apache Kafka diff examples