Skip to content

Commit 4bc38a7

Browse files
committed
Commit talk
1 parent 9e6c25e commit 4bc38a7

File tree

4 files changed

+281
-3
lines changed

4 files changed

+281
-3
lines changed
18.2 KB
Binary file not shown.

presentation/graphics.graffle

11.3 KB
Binary file not shown.

presentation/presentation.tex

Lines changed: 281 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,17 +100,295 @@
100100
\tableofcontents
101101
\end{frame}
102102

103-
\section{}
103+
\section{Docker}
104+
105+
\begin{frame}{What is docker?}
106+
Problem: It’s hard to build and run software
107+
\pause
108+
\begin{itemize}
109+
\item getting it to build in the first place
110+
\pause
111+
\item having all required dependencies installed
112+
\pause
113+
\item at the right version
114+
\pause
115+
\item on different OS versions / distributions
116+
\end{itemize}
117+
\end{frame}
118+
119+
\begin{frame}{Docker is:}
120+
Problem: It’s hard to build and run software
121+
\\[\baselineskip]
122+
Solution: Use the Linux system-call interface as the lowest-common
123+
denominator
124+
\pause
125+
\begin{itemize}
126+
\item No built-in applications, not even \texttt{ls}
127+
\item No built-in libraries
128+
\end{itemize}
129+
\pause
130+
\textit{All} dependencies must be packed into the container image
131+
\end{frame}
132+
133+
\begin{frame}
134+
\includegraphics[height=0.95\paperheight,center]{what-you-ship1.pdf}
135+
\end{frame}
136+
137+
\begin{frame}{Advantages}
138+
\begin{itemize}
139+
\item Speed: No more building code you didn’t write
140+
\pause
141+
\item Consistency: What you develop and test on your machine is
142+
\textit{exactly} what runs in production
143+
\pause
144+
\item Flexibility: Your app can run unmodified on any recent version of any
145+
Linux distribution like Ubuntu or CentOS
146+
\end{itemize}
147+
\end{frame}
148+
149+
\begin{frame}[fragile]{Example}
150+
151+
\begin{verbatim}
152+
docker run --rm -it centos
153+
# yum --version
154+
docker run --rm -it ubuntu
155+
# apt --version
156+
\end{verbatim}
157+
158+
\pause
159+
160+
\only<2>{
161+
\begin{itemize}
162+
\item \texttt{--rm}: remove after exit, for temporary containers
163+
\item \texttt{-i}: interactive, so open stdin
164+
\item \texttt{-t}: connect a terminal instead of a simple in-out stream
165+
\end{itemize}
166+
}
167+
168+
\pause
169+
170+
\begin{verbatim}
171+
docker run --rm --name my-tmp-db \
172+
-e MYSQL_ROOT_PASSWORD=x mysql
173+
174+
docker run --rm -it --link my-tmp-db \
175+
mysql \
176+
mysql -h my-tmp-db -px
177+
\end{verbatim}
178+
179+
\end{frame}
180+
181+
\begin{frame}{Big benefit for everyone}
182+
\sizefont{6}
183+
If you ever need to run a database or some other application for
184+
development purposes, it’s faster and easier to use docker
185+
\end{frame}
186+
187+
\section{Kubernetes}
188+
189+
\begin{frame}
190+
\tableofcontents[currentsection]
191+
\end{frame}
192+
193+
\begin{frame}{What is kubernetes?}
194+
Problem: It’s hard to manage distributed systems
195+
\\[\baselineskip]
196+
\pause
197+
\only<2>{(A distributed system is a piece of software that requires more
198+
than one computer to run)}
199+
\pause
200+
\begin{itemize}
201+
\item Differences between running on a developer machine vs. running in a
202+
cloud or datacenter
203+
\item How do the pieces find each other?
204+
\item What happens when pieces fail?
205+
\item How do you upgrade?
206+
\end{itemize}
207+
\end{frame}
208+
209+
\begin{frame}{Kubernetes is:}
210+
Problem: It’s hard to manage distributed systems
211+
\\[\baselineskip]
212+
Solution: Uniform APIs around implementations of good practices
213+
\end{frame}
214+
215+
\begin{frame}{Docker and Kubernetes}
216+
\includegraphics[width=0.8\paperwidth,center]{docker-k8s-connection.pdf}
217+
\end{frame}
218+
219+
\begin{frame}{Example of a good practice}
220+
Problem: A computer can physically fail, taking down the program running
221+
on it
222+
\\[\baselineskip]
223+
Solution: \\
224+
\only<2-5>{
225+
\begin{itemize}
226+
\pause
227+
\item Run copies on different computers
228+
\pause
229+
\item When a machine fails, create new copies of the programs on different
230+
computers
231+
\pause
232+
\item Redundant load balancers so clients don’t have to know about machine
233+
changes
234+
\pause
235+
\item Figure out some way to make the clients be ok with the load-balancers
236+
changing
237+
\end{itemize}
238+
}
239+
\pause
240+
That gets tricky to implement! You can use the standard kubernetes
241+
implementations of Service + Deployment instead.
242+
\end{frame}
243+
244+
\begin{frame}{Deployment}
245+
Run $n$ copies of a container
246+
\pause
247+
\begin{itemize}
248+
\item If a container crashes, restart it
249+
\item If a computer crashes, restart the containers on a different one
250+
\item Give me a knob to easily adjust how many copies there are
251+
\item Give me an easy way to do rolling upgrades too
252+
\end{itemize}
253+
\end{frame}
254+
255+
\begin{frame}[fragile]{Deployment}
256+
\sizefont{2}
257+
\begin{verbatim}
258+
apiVersion: extensions/v1beta1
259+
kind: Deployment
260+
metadata:
261+
name: timestamp
262+
spec:
263+
replicas: 1
264+
template:
265+
metadata:
266+
labels:
267+
app: timestamp
268+
spec:
269+
containers:
270+
- name: hello
271+
image: alpine/socat
272+
command: ["socat", "-v", "TCP4-LISTEN:1234,fork,reuseaddr",
273+
'SYSTEM:echo "Timestamp service: $(date)"']
274+
\end{verbatim}
275+
\end{frame}
276+
277+
\begin{frame}{Service}
278+
Create a named thing that sends traffic to specific containers
279+
\pause
280+
\begin{itemize}
281+
\item Shows up in DNS inside cluster
282+
\item Fault-tolerant
283+
\item Updates dynamically
284+
\end{itemize}
285+
\end{frame}
286+
287+
\begin{frame}[fragile]{Service}
288+
\sizefont{2}
289+
\begin{verbatim}
290+
apiVersion: v1
291+
kind: Service
292+
metadata:
293+
name: timestamp
294+
labels:
295+
app: timestamp
296+
spec:
297+
type: NodePort
298+
ports:
299+
- port: 1234
300+
name: timestamp
301+
selector:
302+
app: timestamp
303+
\end{verbatim}
304+
Run \texttt{kubectl explain} for more details
305+
\end{frame}
306+
307+
\begin{frame}[fragile]{Demo}
308+
\begin{verbatim}
309+
$ kubectl apply -f ../src/timestamp-svc.yaml
310+
311+
$ kubectl get all
312+
313+
$ kubectl run --rm --restart=Never -it \
314+
--image centos test-shell
315+
[root@test-shell /]# curl timestamp:1234
316+
[delete pod]
317+
[root@test-shell /]# curl timestamp:1234
318+
319+
\end{verbatim}
320+
\end{frame}
321+
322+
\section{Driving Kubernetes with Python}
323+
324+
\begin{frame}
325+
\tableofcontents[currentsection]
326+
\end{frame}
327+
328+
\begin{frame}{APIs}
329+
\begin{itemize}
330+
\item Both docker and kubernetes are HTTP APIs under the hood
331+
\item \texttt{curl --unix-socket /var/run/docker.sock 'localhost/v1.37/containers/json'}
332+
\pause
333+
\item kubectl essentially converts YAML to JSON and POSTs it
334+
\pause
335+
\item You can create and test distributed computing entities on your laptop
336+
using the same API as what runs in production
337+
\end{itemize}
338+
\end{frame}
339+
340+
\begin{frame}{Python code time}
341+
\end{frame}
342+
343+
\section{Takeaways}
344+
345+
\begin{frame}
346+
\tableofcontents[currentsection]
347+
\end{frame}
348+
349+
\begin{frame}{Takeways}
350+
\begin{itemize}
351+
\item Whenever installing a database or application for development
352+
purposes, it’s probably faster and easier to use docker
353+
\pause
354+
\item If there are multiple moving pieces to your app, kubernetes can give
355+
uniformity across dev, test, and production
356+
\end{itemize}
357+
\pause
358+
Questions?
359+
\end{frame}
104360

105361
\section{Exercises}
106362

363+
\begin{frame}
364+
\tableofcontents[currentsection]
365+
\end{frame}
366+
107367
\begin{frame}{Exercises}
108368
\begin{itemize}
109-
\item ...
369+
\item Install docker and run a container
370+
\item Run a container in kubernetes
371+
\item Run the example code that talks to kubernetes
110372
\end{itemize}
111373
Advanced:
112374
\begin{itemize}
113-
\item ...
375+
\item Build tooling for convenient local builds and runs of containers on
376+
kubernetes
377+
\end{itemize}
378+
\end{frame}
379+
380+
\section{The Future of PyYYC}
381+
382+
\begin{frame}
383+
\tableofcontents[currentsection]
384+
\end{frame}
385+
386+
\begin{frame}{The Future of PyYYC}
387+
\begin{itemize}
388+
\item Summer hiatus
389+
\item Not 100\% sure on coming back in the fall
390+
\item The only significant way you can help: email [email protected]
391+
with talk abstracts
114392
\end{itemize}
115393
\end{frame}
116394

presentation/what-you-ship1.pdf

14.4 KB
Binary file not shown.

0 commit comments

Comments
 (0)