apiVersion: apps/v1beta1 kind: StatefulSet metadata: name: kafka namespace: kafka spec: selector: matchLabels: app: kafka serviceName: "broker" replicas: 3 updateStrategy: type: OnDelete template: metadata: labels: app: kafka annotations: spec: terminationGracePeriodSeconds: 30 initContainers: - name: init-config image: solsson/kafka-initutils@sha256:18bf01c2c756b550103a99b3c14f741acccea106072cd37155c6d24be4edd6e2 env: - name: NODE_NAME valueFrom: fieldRef: fieldPath: spec.nodeName - name: POD_NAME valueFrom: fieldRef: fieldPath: metadata.name - name: POD_NAMESPACE valueFrom: fieldRef: fieldPath: metadata.namespace command: ['/bin/bash', '/etc/kafka-configmap/init.sh'] volumeMounts: - name: configmap mountPath: /etc/kafka-configmap - name: config mountPath: /etc/kafka containers: - name: broker image: solsson/kafka:1.0.1@sha256:1a4689d49d6274ac59b9b740f51b0408e1c90a9b66d16ad114ee9f7193bab111 env: - name: KAFKA_LOG4J_OPTS value: -Dlog4j.configuration=file:/etc/kafka/log4j.properties - name: JMX_PORT value: "5555" ports: - name: inside containerPort: 9092 - name: outside containerPort: 9094 - name: jmx containerPort: 5555 command: - ./bin/kafka-server-start.sh - /etc/kafka/server.properties resources: requests: cpu: 100m memory: 512Mi readinessProbe: tcpSocket: port: 9092 timeoutSeconds: 1 volumeMounts: - name: config mountPath: /etc/kafka - name: data mountPath: /var/lib/kafka/data volumes: - name: configmap configMap: name: broker-config - name: config emptyDir: {} volumeClaimTemplates: - metadata: name: data spec: accessModes: [ "ReadWriteOnce" ] storageClassName: kafka-broker resources: requests: storage: 40Gi