Using a Kafka service
The YAML code below creates two objects: a ExoscaleKafka
instance and a Pod accessing it to show information about the instance.
The latter references the kafka-creds
secret that will contain the access keys required to connect to the instance.
We provide a sample container that supports client side certificates and should work out of the box. It will create a test topic and will continuously publish to and read from that topic. Aiven has example code in multiple languages that may help you to get started with your own application. |
apiVersion: exoscale.appcat.vshn.io/v1
kind: ExoscaleKafka
metadata:
name: my-kafka-example
namespace: my-namespace
spec:
parameters:
service:
zone: ch-dk-2
writeConnectionSecretToRef:
name: kafka-creds (1)
---
apiVersion: v1
kind: Pod
metadata:
name: kafka-client
namespace: my-namespace
spec:
containers:
- name: client
image: ghcr.io/vshn/appcat-kafka-example:v1.0.0
args:
- --ca
- /.kafka/certs/ca.crt
- --cert
- /.kafka/certs/service.cert
- --key
- /.kafka/certs/service.key
envFrom:
- secretRef:
name: kafka-creds (2)
volumeMounts:
- name: certs
mountPath: /.kafka/certs
volumes:
- name: certs
secret:
secretName: kafka-creds (2)
1 | The operator will create a secret with the access keys to connect to the instance. |
2 | The pod and its volume will use the secret. |