blob: 3ef7b3d7e4fcdd565e865380baf3cfcea7380ada [file] [log] [blame]
Richard Jankowskie5858082018-01-15 18:25:38 -05001apiVersion: v1
2kind: Service
3metadata:
4 name: zoo1
5spec:
6 clusterIP: None
7 selector:
8 app: zookeeper-1
9 ports:
10 - name: client
11 port: 2181
12 targetPort: 2181
13 - name: follower
14 port: 2888
15 targetPort: 2888
16 - name: leader
17 port: 3888
18 targetPort: 3888
19---
20apiVersion: v1
21kind: Service
22metadata:
23 name: zoo2
24spec:
25 clusterIP: None
26 selector:
27 app: zookeeper-2
28 ports:
29 - name: client
30 port: 2181
31 targetPort: 2181
32 - name: follower
33 port: 2888
34 targetPort: 2888
35 - name: leader
36 port: 3888
37 targetPort: 3888
38---
39apiVersion: v1
40kind: Service
41metadata:
42 name: zoo3
43spec:
44 clusterIP: None
45 selector:
46 app: zookeeper-3
47 ports:
48 - name: client
49 port: 2181
50 targetPort: 2181
51 - name: follower
52 port: 2888
53 targetPort: 2888
54 - name: leader
55 port: 3888
56 targetPort: 3888
57---
58apiVersion: apps/v1beta1
59kind: StatefulSet
60metadata:
61 name: zookeeper1
62spec:
63 serviceName: zoo1
64 replicas: 1
65 selector:
66 matchLabels:
67 app: zookeeper-1
68 template:
69 metadata:
70 labels:
71 app: zookeeper-1
Stephane Barbarie5e8d9e42018-02-07 16:15:05 -050072 annotations:
73 cni: "weave"
Richard Jankowskie5858082018-01-15 18:25:38 -050074 spec:
75 containers:
76 - name: zoo1
77 image: zookeeper:3.4.11
78 ports:
79 - containerPort: 2181
80 - containerPort: 2888
81 - containerPort: 3888
82 env:
83 - name: NAMESPACE
84 valueFrom:
85 fieldRef:
86 fieldPath: metadata.namespace
87 - name: ZOO_MY_ID
88 value: "1"
89 - name: ZOO_SERVERS
90 value: >
91 server.1=zookeeper1-0.zoo1.$(NAMESPACE).svc.cluster.local:2888:3888
92 server.2=zookeeper2-0.zoo2.$(NAMESPACE).svc.cluster.local:2888:3888
93 server.3=zookeeper3-0.zoo3.$(NAMESPACE).svc.cluster.local:2888:3888
94---
95apiVersion: apps/v1beta1
96kind: StatefulSet
97metadata:
98 name: zookeeper2
99spec:
100 serviceName: zoo2
101 replicas: 1
102 selector:
103 matchLabels:
104 app: zookeeper-2
105 template:
106 metadata:
107 labels:
108 app: zookeeper-2
Stephane Barbarie5e8d9e42018-02-07 16:15:05 -0500109 annotations:
110 cni: "weave"
Richard Jankowskie5858082018-01-15 18:25:38 -0500111 spec:
112 containers:
113 - name: zoo2
114 image: zookeeper:3.4.11
115 ports:
116 - containerPort: 2181
117 - containerPort: 2888
118 - containerPort: 3888
119 env:
120 - name: NAMESPACE
121 valueFrom:
122 fieldRef:
123 fieldPath: metadata.namespace
124 - name: ZOO_MY_ID
125 value: "2"
126 - name: ZOO_SERVERS
127 value: >
128 server.1=zookeeper1-0.zoo1.$(NAMESPACE).svc.cluster.local:2888:3888
129 server.2=zookeeper2-0.zoo2.$(NAMESPACE).svc.cluster.local:2888:3888
130 server.3=zookeeper3-0.zoo3.$(NAMESPACE).svc.cluster.local:2888:3888
131---
132apiVersion: apps/v1beta1
133kind: StatefulSet
134metadata:
135 name: zookeeper3
136spec:
137 serviceName: zoo3
138 replicas: 1
139 selector:
140 matchLabels:
141 app: zookeeper-3
142 template:
143 metadata:
144 labels:
145 app: zookeeper-3
Stephane Barbarie5e8d9e42018-02-07 16:15:05 -0500146 annotations:
147 cni: "weave"
Richard Jankowskie5858082018-01-15 18:25:38 -0500148 spec:
149 containers:
150 - name: zoo3
151 image: zookeeper:3.4.11
152 ports:
153 - containerPort: 2181
154 - containerPort: 2888
155 - containerPort: 3888
156 env:
157 - name: NAMESPACE
158 valueFrom:
159 fieldRef:
160 fieldPath: metadata.namespace
161 - name: ZOO_MY_ID
162 value: "3"
163 - name: ZOO_SERVERS
164 value: >
165 server.1=zookeeper1-0.zoo1.$(NAMESPACE).svc.cluster.local:2888:3888
166 server.2=zookeeper2-0.zoo2.$(NAMESPACE).svc.cluster.local:2888:3888
167 server.3=zookeeper3-0.zoo3.$(NAMESPACE).svc.cluster.local:2888:3888