-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathusing-docker-kubernetes.RMd
180 lines (90 loc) · 3.65 KB
/
using-docker-kubernetes.RMd
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
---
title: "Intro to Docker and Kubernetes"
author: 'Kim Fitter '
date: "8 July 2020"
output:
xaringan::moon_reader: default
html_document: default
---
```{r setup, include=FALSE}
options(htmltools.dir.version = TRUE)
knitr::opts_chunk$set(
echo = FALSE,
message = FALSE,
warning=FALSE
)
```
```{r load packages}
library(xaringan)
```
class: inverse, center, middle
<center> <img src="https://pbs.twimg.com/media/EbSaQLpXgAAaJY8?format=jpg&name=medium" height="500"> </center>
---
## What are Containers ?
- Packaged code, dependencies and and config
- Share operating systems
- Predictable
- Repeatable
- Immutable
- Solves the “but it works on my machine” problem
<center>
<span>
<img src="https://www.docker.com/sites/default/files/d8/2018-11/container-vm-whatcontainer_2.png" height="250" > <img src="https://www.docker.com/sites/default/files/d8/2018-11/docker-containerized-appliction-blue-border_2.png" height="250" >
</span></center>
---
## What is Docker?
Docker by Docker Inc automates the development, testing and deployment of applications inside software containers.
- Docker engine is the layer on which Docker runs.
- The Docker Client is the UI
- The Dockerfile is just a text file list of steps to build the image to get the container
---
## Docker Images
A Docker **image** is a pre-built environment for a certain technology or service.
For example official Node.js image is available at the [Docker Hub]( https://hub.docker.com/_/node/).
<center> <img src="https://docs.microsoft.com/en-us/dotnet/architecture/microservices/container-docker-introduction/media/docker-containers-images-registries/taxonomy-of-docker-terms-and-concepts.png" height="350"> </center>
---
## How to Run a Node.js app using Docker
Create app and a <a href="https://medium.com/faun/how-to-build-a-node-js-application-with-docker-f596fbd3a51">Dockerfile</a> :
<code>
FROM node:12-alpine
RUN mkdir -p /home/node/app/node_modules && chown -R node:node /home/node/app
WORKDIR /home/node/app
COPY package*.json ./
USER node
RUN npm install
COPY --chown=node:node . .
EXPOSE 3000
CMD [ "node", "app.js" ]
</code>
Then build image and run container, and view your app in `http://localhost:3000`
---
class: inverse
## What is Kubernetes
Kubernetes is also known as **K8S**.
The abbreviation **K8s** is derived by replacing the eight letters of “ubernete” with the digit 8.
The Kubernetes Project was **open-sourced** by Google in 2014
<center> <img src="https://pbs.twimg.com/media/EaBLxWGWkAMkqnB?format=jpg&name=small" width ="300"> </center>
---
class: inverse
## What does Kubernetes do?
Kubernetes is a container management platform that orchestrates container workloads.
- A cluster is a set of nodes (physical machines) virtually connected with each other and run containerised applications.
- A master node manages the cluster and schedules the containers to run on the cluster’s nodes.
- A pod within a node contains one or more containers
- Specify configuration with YAML (Yet Another Markup Language)
<center> <img src="https://miro.medium.com/max/1400/1*opw2Ethwo-ebWtqijq8ZBQ.png" width="350"> </center>
---
class: inverse
## When to use Kubernetes?
- Kubernetes can be an overkill for simple applications
- Complex with steep learning curve
- Short term decrease in productivity to achieve consistency
- Need to hire K8s expertise
- Powerful at scale
<center> <img src="https://pbs.twimg.com/media/EPETtt-WsAYPWRI?format=jpg&name=small" width="300"> </center>
---
class: inverse, center, middle
# Thanks!
Slides created with the `xaringan` R package
### Link to materials
https://github.com/kimnewzealand/R-tutorials