Kubernetes kafka 发表于 2018-03-07 | 分类于 Kubernetes , Deployment deplopyment12345678910111213141516171819202122232425262728293031323334apiVersion: extensions/v1beta1kind: Deploymentmetadata: name: kafka-deployment labels: app: kafka-deploymentspec: replicas: 1 selector: matchLabels: app: kafka-deployment template: metadata: labels: app: kafka-deployment spec: containers: - image: wurstmeister/kafka imagePullPolicy: IfNotPresent name: kafka-deployment ports: - containerPort: 9092 - containerPort: 30092 env: - name: KAFKA_ADVERTISED_HOST_NAME value: "35.198.224.244" - name: KAFKA_ADVERTISED_PORT value: "9092" - name: KAFKA_BROKER_ID value: "1" - name: KAFKA_ZOOKEEPER_CONNECT value: 10.47.250.170:2181 - name: KAFKA_CREATE_TOPICS value: "ethex:1:1" 注意:KAFKA_ADVERTISED_HOST_NAME 填ServiceIP Service1234567891011121314apiVersion: v1kind: Servicemetadata: labels: app: kafka-service name: kafka-servicespec: type: LoadBalancer ports: - name: kafka-port port: 9092 targetPort: 9092 selector: app: kafka-deployment