apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: broker
spec:
  selector:
    matchLabels:
      app: broker
  serviceName: broker
  replicas: 1
  template:
    metadata:
      labels:
        app: broker
    spec:
      containers:
      - name: kafka
        image: wurstmeister/kafka
        imagePullPolicy: IfNotPresent
        ports:
        - containerPort: 9092
        - containerPort: 9094
        resources:
          requests:
            cpu: 128m
            memory: 1Gi
          limits:
            cpu: 128m
            memory: 1Gi
        env:
        - name: "KAFKA_HEAP_OPTS"
          value: "-Xmx512M -Xms512M"
        - name: KAFKA_LISTENERS
          value: "INSIDE://:9094,OUTSIDE://localhost:9092"
        - name: KAFKA_ADVERTISED_LISTENERS
          value: "INSIDE://:9094,OUTSIDE://localhost:9092"
        - name: KAFKA_LISTENER_SECURITY_PROTOCOL_MAP
          value: "INSIDE:PLAINTEXT,OUTSIDE:PLAINTEXT"
        - name: KAFKA_INTER_BROKER_LISTENER_NAME
          value: INSIDE
        - name: KAFKA_ZOOKEEPER_CONNECT
          value: zookeeper:2181
        - name: KAFKA_BROKER_ID
          value: "0"
