kind: Deployment
apiVersion: apps/v1
metadata:
  name: kafka-broker0
spec:
  replicas: 1
  selector:
    matchLabels:
        app: kafka
        id: "0"
  template:
    metadata:
      annotations:
        prometheus.io/port: '7071'
        # prometheus.io/scrape: 'true'
        ververica.com/scrape_every_2s: 'true'
      labels:
        app: kafka
        id: "0"
    spec:
      containers:
      - name: kafka
        image: 9923/kafka_jmx:3
        imagePullPolicy: Always
        resources:
          requests:
            cpu: 1000m
            memory: 4000Mi
          limits:
            cpu: 1500m
            memory: 8000Mi
        ports:
        - containerPort: 9092
        - containerPort: 7071
        env:
        # - name: KAFKA_LISTENERS
        #   value: "LISTENER_INT://localhost:29092,LISTENER_EXT://kafka-service:9092"
        # - name: KAFKA_ADVERTISED_LISTENERS
        #   value: "LISTENER_INT://localhost:29092,LISTENER_EXT://kafka-service:9092"
        # - name: KAFKA_LISTENER_SECURITY_PROTOCOL_MAP 
        #   value: "LISTENER_INT:PLAINTEXT,LISTENER_EXT:PLAINTEXT"
        # - name: KAFKA_INTER_BROKER_LISTENER_NAME 
        #   value: "LISTENER_EXT"
        - name: MY_POD_IP
          valueFrom:
            fieldRef:
              fieldPath: status.podIP
        - name: KAFKA_LISTENERS
          value: "LISTENER_INT://0.0.0.0:9092"
        - name: KAFKA_ADVERTISED_LISTENERS
          value: "LISTENER_INT://$(MY_POD_IP):9092"
        - name: KAFKA_LISTENER_SECURITY_PROTOCOL_MAP 
          value: "LISTENER_INT:PLAINTEXT"
        - name: KAFKA_INTER_BROKER_LISTENER_NAME 
          value: "LISTENER_INT"
        #- name: KAFKA_ADVERTISED_PORT
        #  value: "9092"
        #- name: KAFKA_ADVERTISED_HOST_NAME
        #  value: kafka-service
        - name: KAFKA_ZOOKEEPER_CONNECT
          value: zoo1:2181
        - name: KAFKA_BROKER_ID
          value: "0"
        - name: KAFKA_CREATE_TOPICS
          value: topic:02:1
        - name: EXTRA_ARGS 
          value: -javaagent:/usr/app/jmx_prometheus_javaagent.jar=7071:/usr/app/prom-jmx-agent-config.yml