Manage Kafka (MSK) Users, Topics and ACL's
Manage MSK Kafka users, topics and ACLs through Crossplane.
This guide connects an existing Amazon MSK cluster to Kubernetes and manages its users, topics and ACLs from there.
You describe the Kafka objects with three manifests: MSK, KafkaUser and Topic. The MSK object observes an existing cluster; the platform does not create or manage the MSK cluster itself. For each user the platform generates a password, stores it in a Kubernetes Secret and in AWS Secrets Manager, associates it with the cluster for SCRAM authentication, and creates the consumer group and topic ACLs you list. Topics are created directly in Kafka.
It is good practice to include the manifests in your application’s Helm chart, so users and topics are deployed together with the application that uses them.
Prerequisites
Section titled “Prerequisites”You need an existing MSK cluster with IAM authentication enabled. Crossplane connects to it with the IRSA role created by the Infralib aws/crossplane module.
Kafka is not enabled by default. Your Infralib configuration needs:
| Module | Flag | Default | What it does |
|---|---|---|---|
platform-apis |
platform-apis.kafka.install |
false |
Installs the MSK, KafkaUser and Topic APIs. Set to true. |
platform-apis |
platform-apis.kafka.environmentConfig.kafkaNamespace |
crossplane-kafka |
Must equal the name of the crossplane-kafka module. |
crossplane-aws |
global.extraProviders |
[] |
Add kafka to install the AWS provider for MSK. |
crossplane-aws |
global.createObservers, global.createNamespacedObservers |
false |
Installs the Secrets Manager provider that stores user passwords. Set both to true. |
crossplane-kafka |
— | — | Manages topics and ACLs inside the cluster. Add the module to the argocd-apps step, after crossplane-core and crossplane-aws. |
aws/kms |
— | — | MSK SCRAM secrets must be encrypted with a customer-managed KMS key, so in practice this terraform module is required. |
If extraProviders already lists other providers, add kafka to the list instead of replacing it. Helm replaces lists instead of merging them.
For the base modules every platform API needs, see Infralib Requirements. A full example is in Infralib Configuration Example at the end of this guide.
1. Register the MSK cluster
Section titled “1. Register the MSK cluster”An MSK object needs only the ARN of the existing cluster:
apiVersion: kafka.entigo.com/v1alpha1kind: MSKmetadata: name: test-crossplane-clusterspec: clusterARN: "arn:aws:kafka:<region>:<account>:cluster/<msk-cluster-name>/<uuid>"This also creates a ProviderConfig in the background, which the Kafka provider uses to manage topics and ACLs. Users and topics refer to this object by its name in spec.clusterName.
For every field, see the MSK API reference.
2. Create a user
Section titled “2. Create a user”A minimal KafkaUser needs only the cluster:
apiVersion: kafka.entigo.com/v1alpha1kind: KafkaUsermetadata: name: user-a namespace: defaultspec: clusterName: test-crossplane-clusterThis creates:
- A Kubernetes Secret with a generated password for the Kafka user
- An AWS Secrets Manager secret
- A Secrets Manager secret policy
- A Secrets Manager secret version
- An MSK SCRAM secret association
Optional settings
Section titled “Optional settings”| Field | Default | What it does |
|---|---|---|
consumerGroups |
unset | Creates consumer group ACLs for the user, one per listed group. |
acls |
unset | Creates topic ACLs for the user. Each entry has a topic and an operation, for example Read or Write. |
For example, a user that reads from two consumer groups and one topic:
apiVersion: kafka.entigo.com/v1alpha1kind: KafkaUsermetadata: name: user-a namespace: defaultspec: clusterName: test-crossplane-cluster consumerGroups: - alpha - gamma acls: - topic: topic-a operation: ReadFor every field, see the KafkaUser API reference.
3. Create a topic
Section titled “3. Create a topic”A minimal Topic needs only the cluster:
apiVersion: kafka.entigo.com/v1alpha1kind: Topicmetadata: name: topic-a namespace: team-aspec: clusterName: test-crossplane-clusterThis creates a Kafka topic in the cluster.
Optional settings
Section titled “Optional settings”| Field | Default | What it does |
|---|---|---|
partitions |
3 |
Number of partitions, minimum 1. |
replicationFactor |
3 |
Replication factor, minimum 1. |
config |
unset | Topic-level configuration, for example retention.ms. |
For example, a single-partition topic with a custom retention:
apiVersion: kafka.entigo.com/v1alpha1kind: Topicmetadata: name: topic-a namespace: team-aspec: clusterName: test-crossplane-cluster partitions: 1 replicationFactor: 1 config: retention.ms: "604800012"For every field, see the Topic API reference.
4. Verify
Section titled “4. Verify”The MSK cluster is observed
Section titled “The MSK cluster is observed”$ kubectl get MSK.kafka.entigo.comNAME SYNCED READY COMPOSITION AGEtest-crossplane-cluster-observed True True msk-observed 7dThe user and its resources are ready
Section titled “The user and its resources are ready”The KafkaUser, its Kubernetes Secret, the Secrets Manager resources and the ACLs all show SYNCED and READY as True:
$ kubectl get KafkaUser.kafka.entigo.comNAME SYNCED READY CONNECTION-SECRET AGEuser-a True True 18h
$ kubectl get secretNAME TYPE DATA AGEtest-crossplane-cluster-user-a-k8s Opaque 1 18h
$ kubectl get secret.secretsmanager.aws.m.upbound.ioNAME SYNCED READY EXTERNAL-NAME AGEtest-crossplane-cluster-user-a True True arn:aws:secretsmanager:us-east-1:xxxxxxxxxxxx:secret:AmazonMSK_test-cluster-name-user-a-U0dDJe 18h
$ kubectl get secretpolicy.secretsmanager.aws.m.upbound.ioNAME SYNCED READY EXTERNAL-NAME AGEtest-crossplane-cluster-user-a-policy True True arn:aws:secretsmanager:us-east-1:xxxxxxxxxxxx:secret:AmazonMSK_test-cluster-name-user-a-U0dDJe 18h
$ kubectl get secretversion.secretsmanager.aws.m.upbound.ioNAME SYNCED READY EXTERNAL-NAME AGEtest-crossplane-cluster-user-a-version True True 18h
$ kubectl get accesscontrollistsNAME READY SYNCED EXTERNAL-NAME AGEuser-a-alpha-cg True True {"ResourceName":"alpha","ResourceType":"Group","ResourcePrincipal":"User:user-a","ResourceHost":"*","ResourceOperation":"Read","ResourcePermissionType":"Allow","ResourcePatternTypeFilter":"Literal"} 18huser-a-gamma-cg True True {"ResourceName":"gamma","ResourceType":"Group","ResourcePrincipal":"User:user-a","ResourceHost":"*","ResourceOperation":"Read","ResourcePermissionType":"Allow","ResourcePatternTypeFilter":"Literal"} 18htopic-a-user-a-read True True {"ResourceName":"topic-a","ResourceType":"Topic","ResourcePrincipal":"User:user-a","ResourceHost":"*","ResourceOperation":"Read","ResourcePermissionType":"Allow","ResourcePatternTypeFilter":"Literal"} 19hThe user’s secret appears in AWS Secrets Manager:
- Secrets Manager secret
- Secret version
- Secret version password, taken from the generated Kubernetes Secret
- Secret policy

The secret is associated with the cluster for SCRAM authentication:

The user’s consumer group ACLs:

The user’s topic ACLs:

The topic exists
Section titled “The topic exists”$ kubectl get Topic.kafka.entigo.com -ANAMESPACE NAME SYNCED READY CONNECTION-SECRET AGEteam-a topic-a True True 19h
$ kubectl get topic.topic.kafka.m.crossplane.ioNAME READY SYNCED EXTERNAL-NAME AGEtopic-a True True team-a 19hThe topic in Kafka:

Troubleshooting
Section titled “Troubleshooting”| Symptom | Cause / fix |
|---|---|
no matches for kind "KafkaUser" (or MSK, Topic) |
The API is not installed. Check the Prerequisites. |
SYNCED is False |
The platform could not create a resource. kubectl describe KafkaUser.kafka.entigo.com <name> (or Topic.kafka.entigo.com) shows the error under Conditions and Events. |
| Topics or ACLs are never created | The Kafka provider manages them. Check that the crossplane-kafka module is installed and that kafkaNamespace matches its name. |
| The Secrets Manager secret is not created | Check that createObservers and createNamespacedObservers are on and that a customer-managed KMS key exists, see Prerequisites. |
EnvironmentConfig
Section titled “EnvironmentConfig”There are no Kafka-specific defaults for developers to worry about. The cluster-wide settings are set once by the platform administrator.
| Setting | Default | What it does |
|---|---|---|
kafkaNamespace |
crossplane-kafka |
Namespace of the crossplane-kafka module. Must equal the module name. |
tags |
{} |
Cloud tags added to the cloud resources created for Kafka users and topics. See Resource Tagging. |
Infralib Configuration Example
Section titled “Infralib Configuration Example”steps: - name: net type: terraform modules: ... - name: kms source: aws/kms ... - name: apps type: argocd-apps modules: ... - name: crossplane-aws source: crossplane-aws inputs: global: createObservers: true createNamespacedObservers: true extraProviders: - kafka - name: crossplane-kafka source: crossplane-kafka ... - name: platform-apis source: platform-apis inputs: platform-apis: kafka: install: true environmentConfig: kafkaNamespace: crossplane-kafka # = the crossplane-kafka module name tags: cost-center: CC-12345