0

我有一个 Kafka 服务,它的 Istio 配置如下:

apiVersion: v1
kind: Service
metadata:
  name: kafka-service
  namespace: kafka-namespace
  labels:
      app:istio
      chart:
      ...
spec:
  ports:
    - port: 9092
      targetPort: kafka
      protocol: TCP
      name: kafka
    - port: 5555
      targetPort: jmx
      protocol: TCP
      name: jmx
  selector:
    app: kafka-cluster
    release: kafka-cluster
    kafka-cluster/region: <region>

我想直接从 Kafka 主题消费和生产。所以,我正在尝试创建一个虚拟服务。这是我使用的配置:

apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: kafka-dns-service
  namespace: internal-gateway
  labels:
    app: istio-crds
    ...
spec:
  hosts:
    - kafka-dns-service.<local-dns>.internal
  gateways:
    - internal-gateway
  tcp:
  - match:
    - port: 9092
    route:
    - destination:
        host: kafka-service.kafka-namespace.svc.cluster.local
        port:
          number: 9092

但是,这似乎不起作用。

当我尝试:

kafka-topics --bootstrap-server kafka-dns-service.<local-dns>.internal:9092 --list

我得到:

Caused by: org.apache.kafka.common.errors.TimeoutException: Timed out waiting for a node assignment. Call: listTopics

有没有人成功使用 Istio 配置 Kafka VirtualService?

4

0 回答 0