通过路由访问OpenShift上部署的Apache Kafka



我已经使用bitnami的这个helm repository在OpenShift上设置了Apache Kafka:https://github.com/bitnami/charts/tree/main/bitnami/kafka

我使用的是最新版本的舵图(20.0.1)

当我尝试从外部连接它时,我得到这个错误

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

我希望使用Bitnami的helm chart部署Apache Kafka

我已经尝试改变内部值。yaml:externalAccess.enabled: trueexternalAccess.service.type=ClusterIPexternalAccess.service.ports.external: 80externalAccess.service.domain: my-route-host

我已经创建了一个路由对象:

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

外部服务:

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

pod的端口:

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

pod的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

与其使用Bitnami图表并试图手动将其集成到OpenShift中,不如使用Strimzi,它已经提供了Route支持。

片段

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

同样,你的错误与你是否有路由无关。你需要增加你的消费进程的堆空间。

最新更新