<p>I've set up Apache Kafka on OpenShift using this helm repository by bitnami:
<a href="https://github.com/bitnami/charts/tree/main/bitnami/kafka" rel="nofollow noreferrer">https://github.com/bitnami/charts/tree/main/bitnami/kafka</a></p>
<p>I am using the latest version of the helm chart (20.0.1)</p>
<p>When I try to connect to it externally I get this error</p>
<pre><code>ERROR Error processing message, terminating consumer process:  (kafka.tools.ConsoleConsumer$)
java.lang.OutOfMemoryError: Java heap space
</code></pre>
<p>I am looking to deploy Apache Kafka using Bitnami's helm chart</p>
<p>I've tried changing inside values.yaml:
<code>externalAccess.enabled: true</code>
<code>externalAccess.service.type=ClusterIP</code>
<code>externalAccess.service.ports.external: 80</code>
<code>externalAccess.service.domain: my-route-host</code></p>
<p>I've created a route object:</p>
<pre><code>spec:
  host: my-route-host
  port:
    targetPort: tcp-kafka
  to:
    kind: Service
    name: kafka-helm-0-external
</code></pre>
<p>the external service:</p>
<pre><code>spec:
  ports:
    - name: tcp-kafka
      protocol: TCP
      port: 80
      targetPort: kafka-external
</code></pre>
<p>the pod's ports:</p>
<pre><code>ports:
  - name: kafka-client
    containerPort: 9092
    protocol: TCP
  - name: kafka-internal
    containerPort: 9093
    protocol: TCP
  - name: kafka-external
    containerPort: 9094
    protocol: TCP
</code></pre>
<p>Inside the pod's server.properties:</p>
<pre><code>listeners=INTERNAL://:9093,CLIENT://:9092,EXTERNAL://:9094
advertised.listeners=INTERNAL://my-pod-host:9093,CLIENT://my-pod-host:9092,EXTERNAL://my-route-host:80
</code></pre>

RoseGoldIsntGay
<p>Rather than use Bitnami charts and trying to manually integrate that into OpenShift, you can use <a href="https://strimzi.io/blog/2019/04/30/accessing-kafka-part-3/" rel="nofollow noreferrer">Strimzi</a> instead, which already offers Route support.</p>
<p>Snippet</p>
<pre><code>apiVersion: kafka.strimzi.io/v1beta1
kind: Kafka
metadata:
  name: my-cluster
spec:
  kafka:
    # ...
    listeners:
      # ...
      - name: external
        port: 9094
        type: route
        tls: true
</code></pre>
<p>Also, your error is unrelated to if you have a Route, or not. You need to increase the heap space of your consumer process.</p>
