--- kind: Deployment apiVersion: apps/v1 metadata: namespace: test-env name: kafka-testenv labels: app: kafka-testenv spec: replicas: 1 selector: matchLabels: app: kafka-testenv template: metadata: labels: app: kafka-testenv spec: containers: - name: kafka image: wurstmeister/kafka volumeMounts: - name: kafka-auth-testenv mountPath: "/etc/kafka" readOnly: true ports: - containerPort: 9092 - containerPort: 9094 env: - name: KAFKA_ADVERTISED_PORT value: "9092" - name: KAFKA_ADVERTISED_HOST_NAME value: "kafka-service" - name: KAFKA_ZOOKEEPER_CONNECT value: zookeeper-testenv:2181 - name: KAFKA_BROKER_ID value: "0" - name: KAFKA_LISTENERS value: SASL_PLAINTEXT://:9094 - name: KAFKA_ADVERTISED_LISTENERS value: SASL_PLAINTEXT://kafka-testenv:9094 - name: KAFKA_INTER_BROKER_LISTENER_NAME value: SASL_PLAINTEXT - name: KAFKA_SASL_ENABLED_MECHANISMS value: PLAIN - name: KAFKA_SASL_MECHANISM_INTER_BROKER_PROTOCOL value: PLAIN - name: KAFKA_OPTS value: "-Djava.security.auth.login.config=/etc/kafka/kafka_server_jaas.conf" volumes: - name: kafka-auth-testenv configMap: name: kafka-auth-testenv --- apiVersion: v1 kind: Service metadata: name: kafka-testenv namespace: test-env labels: app: kafka-testenv spec: ports: - port: 9092 name: kafka-inside-test - port: 9094 name: kafka-outside-test selector: app: kafka-testenv