Accessing topics from an application outside Nais ΒΆ
This guide will show you how to access a Kafka topic from an application outside Nais clusters.
Enable access to the relevant pool in your manifest ΒΆ
.nais/aivenapp.yaml
yaml
apiVersion: aiven.nais.io/v2
kind: AivenApplication
metadata:
name: <MY-APP>
namespace: <MY-TEAM>
spec:
kafka:
pool: <MY-POOL> (TODO: link to available tenant pools)
secretName: <MY-UNIQUE-SECRET-NAME>
protected: trueInfo
The secretName must be a valid DNS label, and must be unique within the namespace.
Apply the AivenApplication ΒΆ
Add the file to your application repository, alongside nais.yaml to deploy with Nais github action.
bash
kubectl apply -f ./nais/aivenapp.yaml --namespace=<MY-TEAM> --context=<MY-ENV>Extract the value of the generated secret ΒΆ
bash
kubectl get secret <MY-UNIQUE-SECRET-NAME> --namespace <MY-TEAM> --contect <MY-ENV> -o jsonpath='{.data}'Make the values available to your application.
Grant access to the topic ΒΆ
The owner of the topic must grant your application access to the topic.