2017-10-23 13:40:58 +08:00
|
|
|
---
|
|
|
|
apiVersion: v1
|
|
|
|
kind: Service
|
|
|
|
metadata:
|
|
|
|
name: kafka-svc
|
|
|
|
labels:
|
|
|
|
app: kafka
|
|
|
|
spec:
|
|
|
|
ports:
|
|
|
|
- port: 9093
|
|
|
|
name: server
|
|
|
|
clusterIP: None
|
|
|
|
selector:
|
|
|
|
app: kafka
|
|
|
|
---
|
|
|
|
apiVersion: policy/v1beta1
|
|
|
|
kind: PodDisruptionBudget
|
|
|
|
metadata:
|
|
|
|
name: kafka-pdb
|
|
|
|
spec:
|
|
|
|
selector:
|
|
|
|
matchLabels:
|
|
|
|
app: kafka
|
|
|
|
minAvailable: 2
|
|
|
|
---
|
|
|
|
apiVersion: apps/v1beta1
|
|
|
|
kind: StatefulSet
|
|
|
|
metadata:
|
|
|
|
name: kafka
|
|
|
|
spec:
|
|
|
|
serviceName: kafka-svc
|
|
|
|
replicas: 3
|
|
|
|
template:
|
|
|
|
metadata:
|
|
|
|
labels:
|
|
|
|
app: kafka
|
|
|
|
spec:
|
|
|
|
affinity:
|
|
|
|
podAntiAffinity:
|
|
|
|
requiredDuringSchedulingIgnoredDuringExecution:
|
|
|
|
- labelSelector:
|
|
|
|
matchExpressions:
|
|
|
|
- key: "app"
|
|
|
|
operator: In
|
|
|
|
values:
|
|
|
|
- kafka
|
|
|
|
topologyKey: "kubernetes.io/hostname"
|
|
|
|
podAffinity:
|
|
|
|
preferredDuringSchedulingIgnoredDuringExecution:
|
|
|
|
- weight: 1
|
|
|
|
podAffinityTerm:
|
|
|
|
labelSelector:
|
|
|
|
matchExpressions:
|
|
|
|
- key: "app"
|
|
|
|
operator: In
|
|
|
|
values:
|
|
|
|
- zk
|
|
|
|
topologyKey: "kubernetes.io/hostname"
|
|
|
|
terminationGracePeriodSeconds: 300
|
|
|
|
containers:
|
|
|
|
- name: k8skafka
|
|
|
|
imagePullPolicy: Always
|
2018-05-04 19:53:39 +08:00
|
|
|
image: harbor-001.jimmysong.io/library/kafka:2.10-0.8.2.1
|
2017-10-23 13:40:58 +08:00
|
|
|
resources:
|
|
|
|
requests:
|
|
|
|
memory: "1Gi"
|
|
|
|
cpu: 500m
|
|
|
|
env:
|
|
|
|
- name: KF_REPLICAS
|
|
|
|
value: "3"
|
|
|
|
ports:
|
|
|
|
- containerPort: 9093
|
|
|
|
name: server
|
|
|
|
command:
|
|
|
|
- /bin/bash
|
|
|
|
- -c
|
|
|
|
- "/opt/kafka/bin/kafkaGenConfig.sh && /opt/kafka/bin/kafka-server-start.sh /opt/kafka/config/server.properties"
|
|
|
|
env:
|
|
|
|
- name: KAFKA_HEAP_OPTS
|
|
|
|
value : "-Xmx512M -Xms512M"
|
|
|
|
- name: KAFKA_OPTS
|
|
|
|
value: "-Dlogging.level=DEBUG"
|
|
|
|
readinessProbe:
|
|
|
|
tcpSocket:
|
|
|
|
port: 9092
|
|
|
|
initialDelaySeconds: 15
|
|
|
|
timeoutSeconds: 1
|