forked from cookeem/kubernetes-zookeeper-cluster
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathzk-deployment.yaml
149 lines (147 loc) · 4.28 KB
/
zk-deployment.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
---
kind: Deployment
apiVersion: extensions/v1beta1
metadata:
name: zk-0
spec:
replicas: 1
template:
metadata:
labels:
app: zk
node: node0
spec:
hostname: zk-0
volumes:
- name: zk-data
hostPath:
path: /data/zk-cluster/zk-data-0
- name: zk-logs
hostPath:
path: /data/zk-cluster/zk-logs-0
containers:
- name: zk-0
image: zookeeper
imagePullPolicy: IfNotPresent
volumeMounts:
- name: zk-data
readOnly: false
mountPath: "/data/zk-data"
- name: zk-logs
readOnly: false
mountPath: "/data/zk-logs"
ports:
- containerPort: 2181
- containerPort: 2888
- containerPort: 3888
#command: ['tail', '-f', '/etc/hosts']
env:
- name: ZOO_MY_ID
value: '0'
- name: ZOO_SERVERS
# 注意!!k8s使用到virtual ip,因此,本机必须使用0.0.0.0 ip地址,否则本机zk启动会异常:
# ERROR [zk1/10.0.0.251:3888:QuorumCnxManager$Listener@547] - Exception while listening
# java.net.BindException: Address not available (Bind failed)错误
value: server.0=0.0.0.0:2888:3888 server.1=zk-1:2888:3888 server.2=zk-2:2888:3888
- name: ZOO_DATA_DIR
value: '/data/zk-data'
- name: ZOO_DATA_LOG_DIR
value: '/data/zk-logs'
---
kind: Deployment
apiVersion: extensions/v1beta1
metadata:
name: zk-1
spec:
replicas: 1
template:
metadata:
labels:
app: zk
node: node1
spec:
hostname: zk-1
volumes:
- name: zk-data
hostPath:
path: /data/zk-cluster/zk-data-1
- name: zk-logs
hostPath:
path: /data/zk-cluster/zk-logs-1
containers:
- name: zk-1
image: zookeeper
imagePullPolicy: IfNotPresent
volumeMounts:
- name: zk-data
readOnly: false
mountPath: "/data/zk-data"
- name: zk-logs
readOnly: false
mountPath: "/data/zk-logs"
ports:
- containerPort: 2181
- containerPort: 2888
- containerPort: 3888
#command: ['tail', '-f', '/etc/hosts']
env:
- name: ZOO_MY_ID
value: '1'
- name: ZOO_SERVERS
# 注意!!k8s使用到virtual ip,因此,本机必须使用0.0.0.0 ip地址,否则本机zk启动会异常:
# ERROR [zk1/10.0.0.251:3888:QuorumCnxManager$Listener@547] - Exception while listening
# java.net.BindException: Address not available (Bind failed)错误
value: server.0=zk-0:2888:3888 server.1=0.0.0.0:2888:3888 server.2=zk-2:2888:3888
- name: ZOO_DATA_DIR
value: '/data/zk-data'
- name: ZOO_DATA_LOG_DIR
value: '/data/zk-logs'
---
kind: Deployment
apiVersion: extensions/v1beta1
metadata:
name: zk-2
spec:
replicas: 1
template:
metadata:
labels:
app: zk
node: node2
spec:
hostname: zk-2
volumes:
- name: zk-data
hostPath:
path: /data/zk-cluster/zk-data-2
- name: zk-logs
hostPath:
path: /data/zk-cluster/zk-logs-2
containers:
- name: zk-2
image: zookeeper
imagePullPolicy: IfNotPresent
volumeMounts:
- name: zk-data
readOnly: false
mountPath: "/data/zk-data"
- name: zk-logs
readOnly: false
mountPath: "/data/zk-logs"
ports:
- containerPort: 2181
- containerPort: 2888
- containerPort: 3888
#command: ['tail', '-f', '/etc/hosts']
env:
- name: ZOO_MY_ID
value: '2'
- name: ZOO_SERVERS
# 注意!!k8s使用到virtual ip,因此,本机必须使用0.0.0.0 ip地址,否则本机zk启动会异常:
# ERROR [zk1/10.0.0.251:3888:QuorumCnxManager$Listener@547] - Exception while listening
# java.net.BindException: Address not available (Bind failed)错误
value: server.0=zk-0:2888:3888 server.1=zk-1:2888:3888 server.2=0.0.0.0:2888:3888
- name: ZOO_DATA_DIR
value: '/data/zk-data'
- name: ZOO_DATA_LOG_DIR
value: '/data/zk-logs'