Skip to content

Accessing topics from an applicationΒΆ

This guide shows you how to access Kafka topics from your application.

PrerequisitesΒΆ

You need an existing topic to access. See Create a Kafka topic for how to create a topic.

Enable access to the relevant pool in your workload definitionΒΆ

.nais/app.yaml
  apiVersion: nais.io/v1alpha1
  kind: Application
  metadata:
    name: <MY-APP>
    namespace: <MY-TEAM>
    labels:
      team: <MY-TEAM>
  spec:
    kafka:
      pool: <MY-POOL>

Select a pool from one of the available pools.

Grant access to the topicΒΆ

The owner of the topic must grant your application access to the topic.

Configure your applicationΒΆ

Aiven has written several articles on how to configure your application. We use SSL, so ignore the SASL-SSL examples:

For all available environment variables, see the reference.

We recommend following the application design guidelines for how to configure your application.

Apply the applicationΒΆ

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

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