blob: 3d4a0169e2f74f168269320c44a33e8df46f328b [file] [log] [blame]
marcoacdae7e2015-12-02 15:35:37 +01001
2==================
3Kubernetes Formula
4==================
5
Jakub Pavlik495d06f2016-06-17 11:33:05 +02006Kubernetes is an open-source system for automating deployment, scaling, and management of containerized applications.
7
8This formula deploys production ready Kubernetes and generate Kubernetes manifests as well.
marcoacdae7e2015-12-02 15:35:37 +01009
10Based on official Kubernetes salt
11https://github.com/kubernetes/kubernetes/tree/master/cluster/saltbase
12
13Extended on Contrail contribution https://github.com/Juniper/kubernetes/blob/opencontrail-integration/docs/getting-started-guides/opencontrail.md
14
15
16Sample pillars
17==============
18
19.. code-block:: yaml
20
21 kubernetes:
Jakub Pavlik495d06f2016-06-17 11:33:05 +020022 master:
23 addons:
24 dns:
25 domain: cluster.local
26 enabled: true
27 replicas: 1
28 server: 10.254.0.10
29 heapster_influxdb:
30 enabled: true
31 public_ip: 185.22.97.132
32 ui:
33 enabled: true
34 public_ip: 185.22.97.131
35 admin:
36 password: password
37 username: admin
38 apiserver:
39 address: 10.0.175.100
40 port: 8080
41 ca: kubernetes
42 enabled: true
43 etcd:
44 host: 127.0.0.1
45 members:
46 - host: 10.0.175.100
47 name: node040
48 name: node040
49 token: ca939ec9c2a17b0786f6d411fe019e9b
50 kubelet:
51 allow_privileged: true
52 network:
53 engine: calico
54 hash: fb5e30ebe6154911a66ec3fb5f1195b2
55 private_ip_range: 10.150.0.0/16
56 version: v0.19.0
57 service_addresses: 10.254.0.0/16
58 storage:
59 engine: glusterfs
60 members:
61 - host: 10.0.175.101
62 port: 24007
63 - host: 10.0.175.102
64 port: 24007
65 - host: 10.0.175.103
66 port: 24007
67 port: 24007
68 token:
69 admin: DFvQ8GJ9JD4fKNfuyEddw3rjnFTkUKsv
70 controller_manager: EreGh6AnWf8DxH8cYavB2zS029PUi7vx
71 dns: RAFeVSE4UvsCz4gk3KYReuOI5jsZ1Xt3
72 kube_proxy: DFvQ8GelB7afH3wClC9romaMPhquyyEe
73 kubelet: 7bN5hJ9JD4fKjnFTkUKsvVNfuyEddw3r
74 logging: MJkXKdbgqRmTHSa2ykTaOaMykgO6KcEf
75 monitoring: hnsj0XqABgrSww7Nqo7UVTSZLJUt2XRd
76 scheduler: HY1UUxEPpmjW4a1dDLGIANYQp1nZkLDk
77 version: v1.2.4
78
marcoacdae7e2015-12-02 15:35:37 +010079
80 kubernetes:
Jakub Pavlik495d06f2016-06-17 11:33:05 +020081 pool:
82 address: 0.0.0.0
83 allow_privileged: true
84 ca: kubernetes
85 cluster_dns: 10.254.0.10
86 cluster_domain: cluster.local
87 enabled: true
88 kubelet:
89 allow_privileged: true
90 config: /etc/kubernetes/manifests
91 frequency: 5s
92 master:
93 apiserver:
94 members:
95 - host: 10.0.175.100
96 etcd:
97 members:
98 - host: 10.0.175.100
99 host: 10.0.175.100
100 network:
101 engine: calico
102 hash: fb5e30ebe6154911a66ec3fb5f1195b2
103 version: v0.19.0
104 token:
105 kube_proxy: DFvQ8GelB7afH3wClC9romaMPhquyyEe
106 kubelet: 7bN5hJ9JD4fKjnFTkUKsvVNfuyEddw3r
107 version: v1.2.4
marcoacdae7e2015-12-02 15:35:37 +0100108
109
Jakub Pavlik495d06f2016-06-17 11:33:05 +0200110
111Kubernetes with OpenContrail network plugin
112------------------------------------------------
marcoacdae7e2015-12-02 15:35:37 +0100113
114On Master:
115
116.. code-block:: yaml
117
118 kubernetes:
119 master:
120 network:
121 engine: opencontrail
122 host: 10.0.170.70
123 port: 8082
124 default_domain: default-domain
125 default_project: default-domain:default-project
126 public_network: default-domain:default-project:Public
127 public_ip_range: 185.22.97.128/26
128 private_ip_range: 10.150.0.0/16
129 service_cluster_ip_range: 10.254.0.0/16
130 network_label: name
131 service_label: uses
132 cluster_service: kube-system/default
133 network_manager:
134 image: pupapaik/opencontrail-kube-network-manager
135 tag: release-1.1-jpa-final-1
136
137On pools:
138
139.. code-block:: yaml
140
141 kubernetes:
142 pool:
143 network:
144 engine: opencontrail
145
146Kubernetes with Flannel
147-----------------------
148
149On Master:
150
151.. code-block:: yaml
152
153 kubernetes:
154 master:
155 network:
156 engine: flannel
marcoa05621f2016-07-14 10:35:24 +0200157If you don't register master as node:
158 etcd:
159 members:
160 - host: 10.0.175.101
161 port: 4001
162 - host: 10.0.175.102
163 port: 4001
164 - host: 10.0.175.103
165 port: 4001
marcoacdae7e2015-12-02 15:35:37 +0100166 common:
167 network:
168 engine: flannel
169
170On pools:
171
172.. code-block:: yaml
173
174 kubernetes:
175 pool:
176 network:
177 engine: flannel
marcoa05621f2016-07-14 10:35:24 +0200178 etcd:
179 members:
180 - host: 10.0.175.101
181 port: 4001
182 - host: 10.0.175.102
183 port: 4001
184 - host: 10.0.175.103
185 port: 4001
marcoacdae7e2015-12-02 15:35:37 +0100186 common:
187 network:
188 engine: flannel
189
190Kubernetes with Calico
191-----------------------
192
193On Master:
194
195.. code-block:: yaml
196
197 kubernetes:
198 master:
199 network:
200 engine: calico
marcoa05621f2016-07-14 10:35:24 +0200201If you don't register master as node:
202 etcd:
203 members:
204 - host: 10.0.175.101
205 port: 4001
206 - host: 10.0.175.102
207 port: 4001
208 - host: 10.0.175.103
209 port: 4001
marcoacdae7e2015-12-02 15:35:37 +0100210
211On pools:
212
213.. code-block:: yaml
214
215 kubernetes:
216 pool:
217 network:
218 engine: calico
marcoa05621f2016-07-14 10:35:24 +0200219 etcd:
220 members:
221 - host: 10.0.175.101
222 port: 4001
223 - host: 10.0.175.102
224 port: 4001
225 - host: 10.0.175.103
226 port: 4001
marcoacdae7e2015-12-02 15:35:37 +0100227
Jakub Pavlik495d06f2016-06-17 11:33:05 +0200228Kubernetes with GlusterFS for storage
229---------------------------------------------
230
231.. code-block:: yaml
232
233 kubernetes:
234 master
235 ...
236 storage:
237 engine: glusterfs
238 port: 24007
239 members:
240 - host: 10.0.175.101
241 port: 24007
242 - host: 10.0.175.102
243 port: 24007
244 - host: 10.0.175.103
245 port: 24007
246 ...
247
marco45fc1b72016-07-02 16:11:18 +0200248Kubernetes namespaces
249---------------------
250
251Create namespace:
252
253.. code-block:: yaml
254
255 kubernetes:
256 master
257 ...
258 namespace:
259 kube-system:
260 enabled: True
261 namespace2:
262 enabled: True
263 namespace3:
264 enabled: False
265 ...
266
267Kubernetes labels
268-----------------
269
270Create namespace:
271
272.. code-block:: yaml
273
274 kubernetes:
275 pool
276 ...
277 host:
278 label:
279 key01:
280 value: value01
281 enable: True
282 key02:
283 value: value02
284 enable: False
285 name: ${linux:system:name}
286 ...
287
Jakub Pavlik495d06f2016-06-17 11:33:05 +0200288Kubernetes Service Definitions in pillars
289==========================================
290
291Following samples show how to generate kubernetes manifest as well and provide single tool for complete infrastructure management.
292
293Deployment manifest
294---------------------
marcoacdae7e2015-12-02 15:35:37 +0100295
296.. code-block:: yaml
297
298 salt:
299 control:
300 enabled: True
301 hostNetwork: True
302 service:
303 memcached:
304 privileged: True
305 service: memcached
306 role: server
307 type: LoadBalancer
308 replicas: 3
309 kind: Deployment
310 apiVersion: extensions/v1beta1
311 ports:
312 - port: 8774
313 name: nova-api
314 - port: 8775
315 name: nova-metadata
316 volume:
317 volume_name:
318 type: hostPath
319 mount: /certs
320 path: /etc/certs
321 container:
322 memcached:
323 image: memcached
324 tag:2
325 ports:
326 - port: 8774
327 name: nova-api
328 - port: 8775
329 name: nova-metadata
330 variables:
331 - name: HTTP_TLS_CERTIFICATE:
332 value: /certs/domain.crt
333 - name: HTTP_TLS_KEY
334 value: /certs/domain.key
335 volumes:
336 - name: /etc/certs
337 type: hostPath
338 mount: /certs
339 path: /etc/certs
340
341Volumes
342-------
343
344hostPath
Jakub Pavlik495d06f2016-06-17 11:33:05 +0200345==========
marcoacdae7e2015-12-02 15:35:37 +0100346
347.. code-block:: yaml
348
349 container:
350 memcached:
351 ...
352 volumes:
353 - name: /etc/certs
354 mount: /certs
355 type: hostPath
356 path: /etc/certs
357
358emptyDir
359===========
360
361.. code-block:: yaml
362
363 container:
364 memcached:
365 ...
366 volumes:
367 - name: /etc/certs
368 mount: /certs
369 type: emptyDir