blob: a469a616c3b1e42f3b9257d69061557b92f7a30c [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
72 spec:
73 containers:
74 - name: zoo1
75 image: zookeeper:3.4.11
76 ports:
77 - containerPort: 2181
78 - containerPort: 2888
79 - containerPort: 3888
80 env:
81 - name: NAMESPACE
82 valueFrom:
83 fieldRef:
84 fieldPath: metadata.namespace
85 - name: ZOO_MY_ID
86 value: "1"
87 - name: ZOO_SERVERS
88 value: >
89 server.1=zookeeper1-0.zoo1.$(NAMESPACE).svc.cluster.local:2888:3888
90 server.2=zookeeper2-0.zoo2.$(NAMESPACE).svc.cluster.local:2888:3888
91 server.3=zookeeper3-0.zoo3.$(NAMESPACE).svc.cluster.local:2888:3888
92---
93apiVersion: apps/v1beta1
94kind: StatefulSet
95metadata:
96 name: zookeeper2
97spec:
98 serviceName: zoo2
99 replicas: 1
100 selector:
101 matchLabels:
102 app: zookeeper-2
103 template:
104 metadata:
105 labels:
106 app: zookeeper-2
107 spec:
108 containers:
109 - name: zoo2
110 image: zookeeper:3.4.11
111 ports:
112 - containerPort: 2181
113 - containerPort: 2888
114 - containerPort: 3888
115 env:
116 - name: NAMESPACE
117 valueFrom:
118 fieldRef:
119 fieldPath: metadata.namespace
120 - name: ZOO_MY_ID
121 value: "2"
122 - name: ZOO_SERVERS
123 value: >
124 server.1=zookeeper1-0.zoo1.$(NAMESPACE).svc.cluster.local:2888:3888
125 server.2=zookeeper2-0.zoo2.$(NAMESPACE).svc.cluster.local:2888:3888
126 server.3=zookeeper3-0.zoo3.$(NAMESPACE).svc.cluster.local:2888:3888
127---
128apiVersion: apps/v1beta1
129kind: StatefulSet
130metadata:
131 name: zookeeper3
132spec:
133 serviceName: zoo3
134 replicas: 1
135 selector:
136 matchLabels:
137 app: zookeeper-3
138 template:
139 metadata:
140 labels:
141 app: zookeeper-3
142 spec:
143 containers:
144 - name: zoo3
145 image: zookeeper:3.4.11
146 ports:
147 - containerPort: 2181
148 - containerPort: 2888
149 - containerPort: 3888
150 env:
151 - name: NAMESPACE
152 valueFrom:
153 fieldRef:
154 fieldPath: metadata.namespace
155 - name: ZOO_MY_ID
156 value: "3"
157 - name: ZOO_SERVERS
158 value: >
159 server.1=zookeeper1-0.zoo1.$(NAMESPACE).svc.cluster.local:2888:3888
160 server.2=zookeeper2-0.zoo2.$(NAMESPACE).svc.cluster.local:2888:3888
161 server.3=zookeeper3-0.zoo3.$(NAMESPACE).svc.cluster.local:2888:3888