Python社区  »  zookeeper

错误kafka无法连接Kubernetes上的zookeeper(单节点)

Veerapat Boonvanich • 11 月前 • 270 次点击  

我对卡夫卡和库伯内特斯动物园管理员有意见 单节 ,我用测试 我的笔记本电脑和它工作 但我在私人服务器上运行它在卡夫卡的pod中显示错误 我不知道私人服务器上的网络设置

我用kompose把docker compose文件转换成k8s yaml文件

zoo1:名称解析暂时失败

如何修正这个错误?

谢谢你

我的部署和服务yaml文件

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  annotations:
    kompose.cmd: kompose convert
    kompose.version: 1.16.0 (0c01309)
  creationTimestamp: null
  labels:
    io.kompose.service: kafka1
  name: kafka1
spec:
  replicas: 1
  strategy: {}
  template:
    metadata:
      creationTimestamp: null
      labels:
        io.kompose.service: kafka1
    spec:
      containers:
      - env:
        - name: KAFKA_ADVERTISED_LISTENERS
          value: PLAINTEXT://kafka1:9092
        - name: KAFKA_BROKER_ID
          value: "1"
        - name: KAFKA_LOG4J_LOGGERS
          value: kafka.controller=INFO,kafka.producer.async.DefaultEventHandler=INFO,state.change.logger=INFO
        - name: KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR
          value: "1"
        - name: KAFKA_ZOOKEEPER_CONNECT
          value: zoo1:2181
        image: confluentinc/cp-kafka:4.0.0
        name: kafka1
        ports:
        - containerPort: 9092
        resources: {}
      hostname: kafka1
      restartPolicy: Always
status: {}

卡夫卡1-服务.yaml

apiVersion: v1
kind: Service
metadata:
  annotations:
    kompose.cmd: kompose convert
    kompose.version: 1.16.0 (0c01309)
  creationTimestamp: null
  labels:
    io.kompose.service: kafka1
  name: kafka1
spec:
  ports:
  - name: "9092"
    port: 9092
    targetPort: 9092
  selector:
    io.kompose.service: kafka1
status:
  loadBalancer: {}

zoo1-部署.yaml

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  annotations:
    kompose.cmd: kompose convert
    kompose.version: 1.16.0 (0c01309)
  creationTimestamp: null
  labels:
    io.kompose.service: zoo1
  name: zoo1
spec:
  replicas: 1
  strategy: {}
  template:
    metadata:
      creationTimestamp: null
      labels:
        io.kompose.service: zoo1
    spec:
      containers:
      - env:
        - name: ZOO_MY_ID
          value: "1"
        - name: ZOO_PORT
          value: "2181"
        - name: ZOO_SERVERS
          value: server.1=zoo1:2888:3888
        image: zookeeper:3.4.9
        name: zoo1
        ports:
        - containerPort: 2181
        resources: {}
      hostname: zoo1
      restartPolicy: Always
status: {}

zoo1-服务.yaml

apiVersion: v1
kind: Service
metadata:
  annotations:
    kompose.cmd: kompose convert
    kompose.version: 1.16.0 (0c01309)
  creationTimestamp: null
  labels:
    io.kompose.service: zoo1
  name: zoo1
spec:
  ports:
  - name: "2181"
    port: 2181
    targetPort: 2181
  selector:
    io.kompose.service: zoo1
status:
  loadBalancer: {}
Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/50985
 
270 次点击  
分享到微博
文章 [ 1 ]  |  最新文章 11 月前
Saïd Bouras
Reply   •   1 楼
Saïd Bouras    1 年前

你必须为kafla和zookeeper创建无头服务

我建议使用合流赫尔姆图来使用卡夫卡在库伯内特斯,你可以找到他们如何创建无头服务。

日志是什么?到底发生了什么?

希望能帮上忙!