Richard Jankowski | e585808 | 2018-01-15 18:25:38 -0500 | [diff] [blame] | 1 | apiVersion: v1 |
| 2 | kind: Service |
| 3 | metadata: |
| 4 | name: kafka |
| 5 | spec: |
| 6 | clusterIP: None |
| 7 | selector: |
| 8 | app: kafka |
| 9 | ports: |
| 10 | - protocol: TCP |
| 11 | port: 9092 |
| 12 | targetPort: 9092 |
| 13 | --- |
| 14 | apiVersion: apps/v1beta1 |
| 15 | kind: StatefulSet |
| 16 | metadata: |
| 17 | name: kafka |
| 18 | spec: |
| 19 | serviceName: kafka |
| 20 | replicas: 3 |
| 21 | selector: |
| 22 | matchLabels: |
| 23 | app: kafka |
| 24 | template: |
| 25 | metadata: |
| 26 | labels: |
| 27 | app: kafka |
| 28 | spec: |
| 29 | terminationGracePeriodSeconds: 10 |
| 30 | affinity: |
| 31 | podAntiAffinity: |
| 32 | requiredDuringSchedulingIgnoredDuringExecution: |
| 33 | - labelSelector: |
| 34 | matchExpressions: |
| 35 | - key: app |
| 36 | operator: In |
| 37 | values: |
| 38 | - kafka |
| 39 | topologyKey: kubernetes.io/hostname |
| 40 | containers: |
| 41 | - name: kafka |
| 42 | image: wurstmeister/kafka:1.0.0 |
| 43 | ports: |
| 44 | - containerPort: 9092 |
| 45 | env: |
| 46 | - name: KAFKA_ADVERTISED_PORT |
| 47 | value: "9092" |
| 48 | - name: KAFKA_ZOOKEEPER_CONNECT |
| 49 | value: zoo1:2181,zoo2:2181,zoo3:2181 |
| 50 | - name: KAFKA_HEAP_OPTS |
| 51 | value: "-Xmx256M -Xms128M" |