apiVersion: apps/v1
kind: Deployment
metadata:
  name: kafka
  labels:
    infra: kafka
spec:
  replicas: 1
  selector:
    matchLabels:
      infra: kafka
  template:
    metadata:
      labels:
        infra: kafka
    spec:
      containers:
        - name: kafka-node
          image: wurstmeister/kafka:2.13-2.8.1
          ports:
            - containerPort: 9092
            - containerPort: 19092
            - containerPort: 29092
          env:
            - name: KAFKA_ZOOKEEPER_CONNECT
              value: "zookeeper-service:2181"
            - name: KAFKA_LISTENER_SECURITY_PROTOCOL_MAP
              value: "INSIDE:PLAINTEXT,OUTSIDE:PLAINTEXT,OUTLOCAL:PLAINTEXT"
            - name: KAFKA_ADVERTISED_LISTENERS
              value: "INSIDE://:9092,OUTSIDE://kafka-service:19092,OUTLOCAL://localhost:29092"
            - name: KAFKA_LISTENERS
              value: "INSIDE://:9092,OUTSIDE://:19092,OUTLOCAL://:29092"
            - name: KAFKA_INTER_BROKER_LISTENER_NAME
              value: "INSIDE"
            - name: KAFKA_CREATE_TOPICS
              value: "messages:1:1"
