blob: 69b56bfebb213362ff6a34021b77721934e64730 [file] [log] [blame]
# 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 sleep 3; 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.osm
- name: KAFKA_ADVERTISED_PORT
value: "9092"
- name: KAFKA_ZOOKEEPER_CONNECT
value: zookeeper:2181
- name: KAFKA_LOG_RETENTION_HOURS
value: "24"
- name: KAFKA_BROKER_ID
value: "1"
- name: KAFKA_ADVERTISED_LISTENERS
value: "PLAINTEXT://:9092"
- name: KAFKA_LISTENERS
value: "PLAINTEXT://:9092"
- name: KAFKA_INTER_BROKER_LISTENER_NAME
value: "PLAINTEXT"
- name: KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR
value: "1"
volumeMounts:
- name: socket
mountPath: /var/run/docker.sock
volumes:
- name: socket
hostPath:
path: /var/run/docker.sock