apiVersion: apps/v1
kind: Deployment
metadata:
  name: kafka-app
  labels:
    app: kafka
spec:
  replicas: 1
  selector:
    matchLabels:
      app: kafka
  template:
    metadata:
      labels:
        app: kafka
    spec:
      containers:
      - name: kafka
        command: ["bash", "-c", "unset KAFKA_PORT; /etc/confluent/docker/run"]
        image: confluentinc/cp-kafka
        ports:
          - containerPort: 9092
        env:
        - name: KAFKA_ADVERTISED_LISTENERS
          value: PLAINTEXT://kafka-service:29092,PLAINTEXT_HOST://localhost:9092
        - name: KAFKA_BROKER_ID
          value: "1"
        - name: KAFKA_LISTENER_SECURITY_PROTOCOL_MAP
          value: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
        - name: KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR
          value: "1"
        - name: KAFKA_ZOOKEEPER_CONNECT
          value: zookeeper:2181
      restartPolicy: Always
