Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?

Assuming Strimzi is running in KAFKA namespace

This pumps date to mytopic:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: ws-dumper
spec:
  replicas: 2
  selector:
    matchLabels:
      app: ws-dumper  
  template:
    metadata:
      labels:
        app: ws-dumper
    spec:
      containers:
      - env:
        - name: WEBSOCKET_SERVER
          value: wss://api.usb.urbanobservatory.ac.uk/stream
        - name: KAFKA_TOPIC
          value: my-topic
        - name: KAFKA_HOST
          value: my-cluster-kafka-bootstrap.kafka
        name: ws-kafka-bridge
        image: docker.io/matzew/ws-kafka
        imagePullPolicy: IfNotPresent

This is event-dsiplay sink:

and that is a kafka source, reading the mytopic topic:

apiVersion: sources.knative.dev/v1beta1
kind: KafkaSource
metadata:
  name: kafka-source
spec:
  bootstrapServers:
   - my-cluster-kafka-bootstrap.kafka.svc.cluster.local:9092
  topics:
   - my-topic
  sink:
    ref:
      apiVersion: serving.knative.dev/v1
      kind: Service
      name: kafka-display
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment