Creating a user
Written by
Updated at April 8, 2026
If you have a project, you can create an Apache Kafka® user in it.
Using the CLI
-
If the project does not exist yet, create it:
kubectl create namespace <project name>. -
Create a file of the
KafkaUserAccessresource, e.g., using thetouch kafkauseraccess.yamlcommand. -
Open the file and paste the configuration below into it. Create a secret along with the user:
AdminConsumerProducerapiVersion: kafka.stackland.yandex.cloud/v1alpha1 kind: KafkaUserAccess metadata: name: kafka-user labels: kafka-cluster: cluster-omdb spec: authentication: username: kafka-admin passwordSecretRef: name: kafka-credentials key: password acl: - topic: "*" roles: - admin --- apiVersion: v1 kind: Secret metadata: name: kafka-credentials type: kubernetes.io/basic-auth stringData: password: kafka-password ---apiVersion: kafka.stackland.yandex.cloud/v1alpha1 kind: KafkaUserAccess metadata: name: kafka-user-consumer labels: kafka-cluster: cluster-omdb spec: authentication: username: kafka-consumer passwordSecretRef: name: kafka-credentials key: password acl: - topic: someTopic roles: - consumer --- apiVersion: v1 kind: Secret metadata: name: kafka-credentials type: kubernetes.io/basic-auth stringData: password: kafka-password ---apiVersion: kafka.stackland.yandex.cloud/v1alpha1 kind: KafkaUserAccess metadata: name: kafka-user-producer labels: kafka-cluster: cluster-omdb spec: authentication: username: kafka-producer passwordSecretRef: name: kafka-credentials key: password acl: - topic: someTopic roles: - producer --- apiVersion: v1 kind: Secret metadata: name: kafka-credentials type: kubernetes.io/basic-auth stringData: password: kafka-password --- -
Apply the manifest:
kubectl apply -f kafkauseraccess.yaml -n <project name>. Optionally, you can specify the project name in themetadata.namespaceresource property and skip it in the command.
Using the management console
- If you have not opened a project yet, select one.
- In the left-hand menu, select Kafka Clusters.
- Select a cluster.
- Go to the Users tab.
- Click Create user.
- Enter the username and password.
- Click Use pattern below the topic selection.
- To select all topics, enter "*".
- Choose the role.
- Click Create.