Skip to content

Accessing topics from an application

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

0. Prerequisites

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

1. 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> # TODO: link to available tenant pools

2. Grant access to the topic

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

3. 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 fields and configuration options, see the kafka reference. We recommend following the application design guidelines for how to configure your application.

3. 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>