Skip to content

Create a Kafka topic

This guide will show you how to create a Kafka topic.

The fully qualified topic name is the name of the Topic resource prefixed with your team namespace:

<MY-TEAM>.<MY-TOPIC>

This name is also set in the .status.fullyQualifiedName field on your Topic resource once the Topic is synchronized to Aiven.

Creating topics

.nais/topic.yaml
apiVersion: kafka.nais.io/v1
kind: Topic
metadata:
  name: <MY-TOPIC>
  namespace: <MY-TEAM>
  labels:
    team: <MY-TEAM>
spec:
  pool: <MY-POOL>
  acl:
    - team: <MY-TEAM>
      application: <MY-APP>
      access: readwrite   # read, write, readwrite

Select a pool from one of the available pools.

See the Kafka topic reference for a complete list of available options.

Grant access to the topic for other applications (optional)

See manage access for how to grant access to your topic.

Apply the Topic resource

Add the file to your application repository to deploy with NAIS github action.

kubectl apply -f ./nais/topic.yaml --namespace=<MY-TEAM> --context=<MY-CLUSTER>