Home > database >  Accessing Apache Kafka deployed on OpenShift through route
Accessing Apache Kafka deployed on OpenShift through route

Time:12-15

I've set up Apache Kafka on OpenShift using this helm repository by bitnami: https://github.com/bitnami/charts/tree/main/bitnami/kafka

I am using the latest version of the helm chart (20.0.1)

When I try to connect to it externally I get this error

ERROR Error processing message, terminating consumer process:  (kafka.tools.ConsoleConsumer$)
java.lang.OutOfMemoryError: Java heap space

I am looking to deploy Apache Kafka using Bitnami's helm chart

I've tried changing inside values.yaml: externalAccess.enabled: true externalAccess.service.type=ClusterIP externalAccess.service.ports.external: 80 externalAccess.service.domain: my-route-host

I've created a route object:

spec:
  host: my-route-host
  port:
    targetPort: tcp-kafka
  to:
    kind: Service
    name: kafka-helm-0-external

the external service:

spec:
  ports:
    - name: tcp-kafka
      protocol: TCP
      port: 80
      targetPort: kafka-external

the pod's ports:

ports:
  - name: kafka-client
    containerPort: 9092
    protocol: TCP
  - name: kafka-internal
    containerPort: 9093
    protocol: TCP
  - name: kafka-external
    containerPort: 9094
    protocol: TCP

Inside the pod's server.properties:

listeners=INTERNAL://:9093,CLIENT://:9092,EXTERNAL://:9094
advertised.listeners=INTERNAL://my-pod-host:9093,CLIENT://my-pod-host:9092,EXTERNAL://my-route-host:80

CodePudding user response:

I believe you are trying to run a non-HTTP(s) protocol through a Route. Since you are using a raw TCP protocol you are are going to have to use a NodePort/LoadBalancer or something similar.

CodePudding user response:

Rather than use Bitnami charts and trying to manually integrate that into OpenShift, you can use Strimzi instead, which already offers Route support.

Snippet

apiVersion: kafka.strimzi.io/v1beta1
kind: Kafka
metadata:
  name: my-cluster
spec:
  kafka:
    # ...
    listeners:
      # ...
      - name: external
        port: 9094
        type: route
        tls: true

Also, your error is unrelated to if you have a Route, or not. You need to increase the heap space of your consumer process.

  • Related