This repository was archived by the owner on Jul 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
497 lines (489 loc) · 16.8 KB
/
index.html
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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>reveal.js</title>
<link rel="stylesheet" href="css/reset.css">
<link rel="stylesheet" href="css/reveal.css">
<link rel="stylesheet" href="css/theme/night.css">
<!-- Theme used for syntax highlighting of code -->
<link rel="stylesheet" href="lib/css/monokai.css">
<!-- Printing and PDF exports -->
<script>
var link = document.createElement( 'link' );
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = window.location.search.match( /print-pdf/gi ) ? 'css/print/pdf.css' : 'css/print/paper.css';
document.getElementsByTagName( 'head' )[0].appendChild( link );
</script>
</head>
<body>
<div class="reveal">
<div class="slides">
<section id='Title'>
<h1>Kubernetes*</h1>
<p>by TL</p>
<p style="font-size:0.4em;text-align: right;">*YMMV</p>
</section>
<section id='Agenda'>
<section id='Agenda_0'>
<h2>Agenda</h2>
</section>
<section id='Agenda_1'>
<ol>
<li class="fragment fade-up" data-fragment-index="0">
<h4>Terminology</h4>
<p>What's what in Kubernetes</p>
</li>
<li class="fragment fade-up" data-fragment-index="1">
<h4>Architecture</h4>
<p>What are the pieces and how they connect</p>
</li>
<li class="fragment fade-up" data-fragment-index="2">
<h4>Master</h4>
<p>What orchestrates</p>
</li>
</ol>
</section>
<section id='Agenda_2'>
<ol start=4>
<li class="fragment fade-up" data-fragment-index="0">
<h4>Node</h4>
<p>What is orchestrated<p>
</li>
<li class="fragment fade-up" data-fragment-index="1">
<h4>Deplyoment</h4>
<p>How do apps look</p>
</li>
<li class="fragment fade-up" data-fragment-index="2">
<h4>Pod</h4>
<p>Where are my containers</p>
</li>
<ol>
</section>
<section id='Agenda_3'>
<ol start=7>
<li class="fragment fade-up" data-fragment-index="0">
<h4>Service</h4>
<p>How to access my app<p>
</li>
<li class="fragment fade-up" data-fragment-index="1">
<h4>Storage</h4>
<p>Where to persist data</p>
</li>
<li class="fragment fade-up" data-fragment-index="2">
<h4>Deploying</h4>
<p>How to push my app</p>
</li>
<ol>
</section>
<section id="Agenda_4">
<ol start=12>
<li class="fragment fade-up" data-fragment-index="0">
<h4>Secrets</h4>
<p>How to keep yours</p>
</li>
<li class="fragment fade-up" data-fragment-index="1">
<h4>Cron</h4>
<p>Why not do it on k8s</p>
</li>
<li class="fragment fade-up" data-fragment-index="2">
<h4>QA</h4>
</li>
</ol>
</section>
</section>
<section id="Terminology">
<section id='Terminology_0'>
<h4>Terminology</h4>
</section>
<section id='Terminology_1'>
<ul>
<li class="fragment fade-up" data-fragment-index="0">Pod - a set of containers working together</li>
<li class="fragment fade-up" data-fragment-index="1">Master - node that takes care of scheduling</li>
<li class="fragment fade-up" data-fragment-index="2">Worker - node that pods run on</li>
<li class="fragment fade-up" data-fragment-index="3">Namespace - "Folder" for deployments</li>
<li class="fragment fade-up" data-fragment-index="4">Deployment - configured set of pods</li>
</ul>
</section>
<section id='Terminology_2'>
<ul>
<li class="fragment fade-up" data-fragment-index="0">Service - Entrypoint for deployment</li>
<li class="fragment fade-up" data-fragment-index="1">ClusterIP - IP a pod is available on internally</li>
<li class="fragment fade-up" data-fragment-index="2">NodePort - Port on which a service is accessible</li>
<li class="fragment fade-up" data-fragment-index="3">PersistentVolume - Disk resource</li>
<li class="fragment fade-up" data-fragment-index="4">PersistentVolumeClaim - Disk mount</li>
<li class="fragment fade-up" data-fragment-index="5">Secret - encoded/encrypted set of data</li>
</ul>
</section>
</section>
<section id='Architecture'>
<section id='Architecture_0'>
<h4>Architecture</h4>
</section>
<section id='Architecture_1'>
<p>Basic architecture</p>
<img src="assets/arch.jpg" alt="Architecture" style="width: 75%; height: 75%;">
</section>
<section id='Architecture_2'>
<p>Client flow</p>
<img src="assets/nodeport.png" style="width: 50%;" alt="Client flow">
</section>
</section>
<section id='Master'>
<section id='Master_0'>
<h4>Master</h4>
</section>
<section id='Master_1'>
<p>The brain of kubernetes</p>
</section>
<section id='Master_2'>
<p class="fragment fade-up" data-fragment-index="0">Most of orchestration is done here.</p>
<p class="fragment fade-up" data-fragment-index="1">Without it deployments don't work.</p>
<p class="fragment fade-up" data-fragment-index="2">Does both scheduling and communication</p>
<p class="fragment fade-up" data-fragment-index="3">Has maaaany components</p>
</section>
</section>
<section id='Node'>
<section id='Node_0'>
<h4>Node</h4>
</section>
<section id='Node_1'>
<p class="fragment fade-up" data-fragment-index="0">Work horse of kubernetes</p>
<p class="fragment fade-up" data-fragment-index="1">Everything that users see run here</p>
<p class="fragment fade-up" data-fragment-index="2">Can be scaled to really sick numbers (~2k nodes max as of 1.14)</p>
<p class="fragment fade-up" data-fragment-index="3">Continues to run when masters die</p>
</section>
</section>
<section id='Deployment'>
<section id='Deployment_0'>
<h4>Deployment</h4>
</section>
<section id='Deployment_1' style='top: 0px;'>
<p class="fragment fade-up" data-fragment-index="0">Configured via YAML</p>
<p class="fragment fade-up" data-fragment-index="1">Complete set of elements to run app</p>
<p class="fragment fade-up" data-fragment-index="2">Can be scaled on multiple levels</p>
</section>
<section id='Deployment_2'>
<pre>
<code class='hljs' style="top: -50px;position: relative; max-height: 80%;font-size: 60%; line-height: 1.2em;">#yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: front-prod
labels:
app: "front-${APP_ENV}"
spec:
selector:
matchLabels:
app: "front-${APP_ENV}"
replicas: 4
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 25%
template:
metadata:
labels:
app: "front-${APP_ENV}"
spec:
imagePullSecrets:
- name: regcred
containers:
- image: "node/front:${BUILD_NUMBER}"
imagePullPolicy: Always
name: "front-${APP_ENV}"
env:
- name: APP_ENV
value: "${APP_ENV}"
livenessProbe:
httpGet:
path: /app/status
port: 4000
initialDelaySeconds: 60
periodSeconds: 5
readinessProbe:
httpGet:
path: /app/status
port: 4000
initialDelaySeconds: 60
periodSeconds: 5</code>
</pre>
</section>
</section>
<section id='Pod'>
<section id='Pod_0'>
<h4>Pod</h4>
</section>
<section id='Pod_1'>
<p class="fragment fade-up" data-fragment-index="0">One or more containers with shared storage/network</p>
<p class="fragment fade-up" data-fragment-index="1">Logical "whole"</p>
<p class="fragment fade-up" data-fragment-index="2">See each other via localhost and share port space</p>
<p class="fragment fade-up" data-fragment-index="3">F.e. nginx + php-fpm in split containers</p>
</section>
</section>
<section id='Service'>
<section id='Service_0'>
<h4>Service</h4>
</section>
<section id='Service_1'>
<p class="fragment fade-up" data-fragment-index="0">Used to access deployment</p>
<p class="fragment fade-up" data-fragment-index="1">Has different types</p>
<p class="fragment fade-up" data-fragment-index="2">We use nodeport as we're lazy</p>
</section>
<section id='Service_2'>
<pre>
<code class='hljs' style="font-size: 60%; line-height: 1.1em;">#yaml
apiVersion: v1
kind: Service
metadata:
name: "front-${APP_ENV}"
spec:
selector:
app: "front-${APP_ENV}"
type: NodePort
ports:
- name: http
port: 8000
nodePort: 31000
protocol: TCP
</code>
</pre>
</section>
</section>
<section id='Storage'>
<section id='Storage_0'>
<h4>How to Storage?</h4>
</section>
<section id='Storage_1'>
<p class="fragment fade-up" data-fragment-index="0">It's complicated</p>
<p class="fragment fade-up" data-fragment-index="1">There are multiple providers</p>
<p class="fragment fade-up" data-fragment-index="2">Hard to do it yourself</p>
</section>
<section id='Storage_2'>
<pre>
<code class='hljs' style="font-size: 60%; line-height: 1.1em;">#yaml
apiVersion: v1
kind: Endpoints
metadata:
name: glusterfs
namespace: dev
subsets:
- addresses:
- ip: 10.10.10.11
- ip: 10.10.10.12
- ip: 10.10.10.21
ports:
- port: 1
protocol: TCP
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: glusterfs
namespace: dev
spec:
accessModes:
- ReadWriteMany
capacity:
storage: 500Gi
glusterfs:
endpoints: glusterfs
path: gluster
persistentVolumeReclaimPolicy: Retain
volumeMode: Filesystem
</code>
</pre>
</section>
<section id='Storage_2'>
<pre>
<code class='hljs' style="font-size: 60%; line-height: 1.1em;">#yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: postgres-pv-claim
namespace: dev
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 500Gi
</code>
</pre>
</section>
</section>
<section id='Deploying'>
<section id='Deploying_0'>
<h4>Deploying</h4>
</section>
<section id='Deploying_1'>
<p class="fragment fade-up" data-fragment-index="0">As easy as kubectl apply -f my.yaml</p>
<p class="fragment fade-up" data-fragment-index="1">It's done automagically using your recipe</p>
<p class="fragment fade-up" data-fragment-index="2">Almost without issues ;)</p>
</section>
<section id='Deploying_2'>
<pre>
<code class='hljs' style="font-size: 60%; line-height: 1.1em;">#yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
labels:
app: nginx
spec:
replicas: 3
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.7.9
ports:
- containerPort: 80
</code>
</pre>
</section>
<section id='Deploying_3'>
<pre><code class='hljs fragment fade-up'>kubectl apply -f test.yml</code></pre>
<pre><code class='hljs fragment fade-up'>deployment.apps/nginx-deployment created</code></pre>
</section>
<section id='Deploying_4'>
<pre>
<code class='hljs' style='font-size: 60%; line-height: 1.3em;'>Name: nginx-deployment
Namespace: bpp-prod
CreationTimestamp: Fri, 07 Jun 2019 11:32:57 +0200
Labels: app=nginx
Selector: app=nginx
Replicas: 3 desired | 3 updated | 3 total | 3 available | 0 unavailable
StrategyType: RollingUpdate
MinReadySeconds: 0
RollingUpdateStrategy: 25% max unavailable, 25% max surge
Pod Template:
Labels: app=nginx
Containers:
nginx:
Image: nginx:1.7.9
Port: 80/TCP
Host Port: 0/TCP
Environment: none
Mounts: none
Volumes: none
Conditions:
Type Status Reason
---- ------ ------
Available True MinimumReplicasAvailable
Progressing True NewReplicaSetAvailable
OldReplicaSets: none
NewReplicaSet: nginx-deployment-76bf4969df (3/3 replicas created)
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal ScalingReplicaSet 2m48s deployment-controller Scaled up replica set nginx-deployment to 3
</code>
</pre>
</section>
</section>
<section id='Secrets'>
<section id='Secrets_0'>
<h4>Secrets</h4>
</section>
<section id='Secrets_1'>
<p class="fragment fade-up" data-fragment-index="0">Used to deliver secret configs to pods</p>
<p class="fragment fade-up" data-fragment-index="1">Normally it's encoded not encrypted</p>
<p class="fragment fade-up" data-fragment-index="2">Useful but PITA to use properly</p>
</section>
<section id='Secrets_2'>
<p>Advanced example</p2>
</section>
<section id='Secrets_3'>
<pre><code class="hljs" data-line-numbers>#yaml
apiVersion: v1
kind: Secret
metadata:
name: auth-token-secret
type: Opaque
data:
AUTH_TOKEN_VALUE: eHh4LXh4eC14eHg=
</code></pre>
</section>
<section id='Secrets_3'>
<p>Secrets as envs</p>
<pre><code class="hljs" data-line-numbers>#yaml
env:
- name: auth-token-secret
valueFrom:
secretKeyRef:
name: mysecret
key: tomcat-pass
</code></pre>
</section>
</section>
<section id='Cron'>
<section id='Cron_0'>
<h4>Cron</h4>
</section>
<section id='Cron_1'>
<p class="fragment fade-up" data-fragment-index="0">Specific resource type is used cronjobs.batch</p>
<p class="fragment fade-up" data-fragment-index="1">One resource per job == inefficient</p>
<p class="fragment fade-up" data-fragment-index="2">Format is similar to crontab</p>
</section>
<section id='Cron_2'>
<p>Example</p2>
</section>
<section id='Cron_3'>
<pre><code class="hljs" data-line-numbers>#yaml
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: hello
spec:
schedule: "*/1 * * * *"
jobTemplate:
spec:
template:
spec:
containers:
- name: hello
image: busybox
args:
- /bin/sh
- -c
- date; echo Hello from the Kubernetes cluster
restartPolicy: OnFailure
</code></pre>
</section>
</section>
<section id='QA'>
<h4>QA</h4>
</section>
</div>
</div>
<script src="js/reveal.js"></script>
<script>
// More info about config & dependencies:
// - https://github.com/hakimel/reveal.js#configuration
// - https://github.com/hakimel/reveal.js#dependencies
Reveal.initialize({
slideNumber: true,
hash: true,
history: true,
width: 960,
height: 700,
navigationMode: "linear",
dependencies: [
{ src: 'plugin/markdown/marked.js' },
{ src: 'plugin/markdown/markdown.js' },
{ src: 'plugin/notes/notes.js', async: true },
{ src: 'plugin/highlight/highlight.js', async: true }
]
});
</script>
</body>
</html>