--- /dev/null
+# Copyright 2019 TATA ELXSI
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+# implied.
+# See the License for the specific language governing permissions and
+# limitations under the License
+# Author: Vijay Nag B S (vijaynag.bs@tataelxsi.co.in)
+
+apiVersion: v1
+kind: Service
+metadata:
+ name: kafka
+spec:
+ clusterIP: None
+ ports:
+ - port: 9092
+ protocol: TCP
+ targetPort: 9092
+ selector:
+ app: kafka
+ type: ClusterIP
+---
+apiVersion: apps/v1
+kind: StatefulSet
+metadata:
+ name: kafka
+ labels:
+ app: kafka
+spec:
+ replicas: 1
+ serviceName: kafka
+ selector:
+ matchLabels:
+ app: kafka
+ template:
+ metadata:
+ labels:
+ app: kafka
+ spec:
+ initContainers:
+ - name: zookeeper-test
+ image: alpine:latest
+ command: ["sh", "-c", "until nc -zvw1 zookeeper 2181; do sleep3; done; exit 0"]
+ containers:
+ - name: kafka
+ image: wurstmeister/kafka:2.11-1.0.2
+ ports:
+ - containerPort: 9092
+ protocol: TCP
+ env:
+ - name: KAFKA_ADVERTISED_HOST_NAME
+ value: kafka
+ - name: KAFKA_ADVERTISED_PORT
+ value: "9092"
+ - name: KAFKA_ZOOKEEPER_CONNECT
+ value: zookeeper:2181
+ - name: KAFKA_LOG_RETENTION_HOURS
+ value: "24"
+ volumeMounts:
+ - name: socket
+ mountPath: /var/run/docker.sock
+ volumes:
+ - name: socket
+ hostPath:
+ path: /var/run/docker.sock