2017-10-14 01:25:30 +08:00
|
|
|
---
|
|
|
|
apiVersion: v1
|
|
|
|
kind: Service
|
|
|
|
metadata:
|
|
|
|
name: zk-svc
|
|
|
|
labels:
|
|
|
|
app: zk-svc
|
|
|
|
spec:
|
|
|
|
ports:
|
|
|
|
- port: 2888
|
|
|
|
name: server
|
|
|
|
- port: 3888
|
|
|
|
name: leader-election
|
|
|
|
clusterIP: None
|
|
|
|
selector:
|
|
|
|
app: zk
|
|
|
|
---
|
|
|
|
apiVersion: v1
|
|
|
|
kind: ConfigMap
|
|
|
|
metadata:
|
|
|
|
name: zk-cm
|
|
|
|
data:
|
|
|
|
jvm.heap: "1G"
|
|
|
|
tick: "2000"
|
|
|
|
init: "10"
|
|
|
|
sync: "5"
|
|
|
|
client.cnxns: "60"
|
|
|
|
snap.retain: "3"
|
|
|
|
purge.interval: "0"
|
|
|
|
---
|
|
|
|
apiVersion: policy/v1beta1
|
|
|
|
kind: PodDisruptionBudget
|
|
|
|
metadata:
|
|
|
|
name: zk-pdb
|
|
|
|
spec:
|
|
|
|
selector:
|
|
|
|
matchLabels:
|
|
|
|
app: zk
|
|
|
|
minAvailable: 2
|
|
|
|
---
|
|
|
|
apiVersion: apps/v1beta1
|
|
|
|
kind: StatefulSet
|
|
|
|
metadata:
|
|
|
|
name: zk
|
|
|
|
spec:
|
|
|
|
serviceName: zk-svc
|
|
|
|
replicas: 3
|
|
|
|
template:
|
|
|
|
metadata:
|
|
|
|
labels:
|
|
|
|
app: zk
|
|
|
|
spec:
|
|
|
|
affinity:
|
|
|
|
podAntiAffinity:
|
|
|
|
requiredDuringSchedulingIgnoredDuringExecution:
|
|
|
|
- labelSelector:
|
|
|
|
matchExpressions:
|
|
|
|
- key: "app"
|
|
|
|
operator: In
|
|
|
|
values:
|
|
|
|
- zk
|
|
|
|
topologyKey: "kubernetes.io/hostname"
|
|
|
|
containers:
|
|
|
|
- name: k8szk
|
|
|
|
imagePullPolicy: Always
|
2018-05-04 19:53:39 +08:00
|
|
|
image: harbor-001.jimmysong.io/library/zookeeper:3.4.6
|
2017-10-14 01:25:30 +08:00
|
|
|
resources:
|
|
|
|
requests:
|
|
|
|
memory: "2Gi"
|
|
|
|
cpu: "500m"
|
|
|
|
ports:
|
|
|
|
- containerPort: 2181
|
|
|
|
name: client
|
|
|
|
- containerPort: 2888
|
|
|
|
name: server
|
|
|
|
- containerPort: 3888
|
|
|
|
name: leader-election
|
|
|
|
env:
|
|
|
|
- name : ZK_REPLICAS
|
|
|
|
value: "3"
|
|
|
|
- name : ZK_HEAP_SIZE
|
|
|
|
valueFrom:
|
|
|
|
configMapKeyRef:
|
|
|
|
name: zk-cm
|
|
|
|
key: jvm.heap
|
|
|
|
- name : ZK_TICK_TIME
|
|
|
|
valueFrom:
|
|
|
|
configMapKeyRef:
|
|
|
|
name: zk-cm
|
|
|
|
key: tick
|
|
|
|
- name : ZK_INIT_LIMIT
|
|
|
|
valueFrom:
|
|
|
|
configMapKeyRef:
|
|
|
|
name: zk-cm
|
|
|
|
key: init
|
|
|
|
- name : ZK_SYNC_LIMIT
|
|
|
|
valueFrom:
|
|
|
|
configMapKeyRef:
|
|
|
|
name: zk-cm
|
|
|
|
key: tick
|
|
|
|
- name : ZK_MAX_CLIENT_CNXNS
|
|
|
|
valueFrom:
|
|
|
|
configMapKeyRef:
|
|
|
|
name: zk-cm
|
|
|
|
key: client.cnxns
|
|
|
|
- name: ZK_SNAP_RETAIN_COUNT
|
|
|
|
valueFrom:
|
|
|
|
configMapKeyRef:
|
|
|
|
name: zk-cm
|
|
|
|
key: snap.retain
|
|
|
|
- name: ZK_PURGE_INTERVAL
|
|
|
|
valueFrom:
|
|
|
|
configMapKeyRef:
|
|
|
|
name: zk-cm
|
|
|
|
key: purge.interval
|
|
|
|
- name: ZK_CLIENT_PORT
|
|
|
|
value: "2181"
|
|
|
|
- name: ZK_SERVER_PORT
|
|
|
|
value: "2888"
|
|
|
|
- name: ZK_ELECTION_PORT
|
|
|
|
value: "3888"
|
|
|
|
command:
|
|
|
|
- sh
|
|
|
|
- -c
|
|
|
|
- zkGenConfig.sh && zkServer.sh start-foreground
|
|
|
|
readinessProbe:
|
|
|
|
exec:
|
|
|
|
command:
|
|
|
|
- "zkOk.sh"
|
|
|
|
initialDelaySeconds: 10
|
|
|
|
timeoutSeconds: 5
|
|
|
|
livenessProbe:
|
|
|
|
exec:
|
|
|
|
command:
|
|
|
|
- "zkOk.sh"
|
|
|
|
initialDelaySeconds: 10
|
|
|
|
timeoutSeconds: 5
|
2017-10-23 13:40:58 +08:00
|
|
|
securityContext:
|
|
|
|
runAsUser: 1000
|
|
|
|
fsGroup: 1000
|