Technical Manager
William Yeh 葉秉哲 
給 RD 的 Kubernetes 初體驗
… with a series of hands-on labs
2019-06-16
• PhD in Computer Science, NCTU, Taiwan
• CSPO (Certified Scrum Product Owner) from Scrum Alliance
• PSM I (Professional Scrum Master I) from Scrum.org
• Technical manager @ Titansoft (since Mar 2019)
• Server director & Scrum master @ Gogolook
• Active speaker and trainer for software
architecture, DevOps, agile, and theory of
constraints
Agenda
Containers
Kubernetes
Cloud
Containers
Kubernetes
Cloud
Agenda Labs
1.0 — 3.0
4.0 — 5.0
6.0 — 7.0
Agenda
Know promising trends
Adopt gradually
Prepare mindset
Goals
Containers
Kubernetes
Cloud
Labs
1.0 — 3.0
4.0 — 5.0
6.0 — 7.0
Lab material
See the demo first!
Lab material
For each revision, pay attention to:
1. image versions
2. diff in code and configuration
Use git diff --stat HEAD~1 HEAD
to see diff between revisions.
Tag
1.0
2.0
3.0
4.0
4.1
5.0
6.0
7.0
Lab material
https://github.com/William-Yeh/workshop-gcpug
201906
or http://bit.ly/gcpug201906 for short
1. Open browser
2. Git clone to your laptop
GKE Setup🄌
a - Redeem Google Cloud coupon
b - Create project in GCP
c - Create GKE cluster
Redeem coupon
Please follow steps in your handout
NOW!
Create Project in GCP
workshop-repo / gke-steps.md
or,
https://console.cloud.google.com/projectsel
ector2/kubernetes
Create GKE cluster
workshop-repo / gke-steps.md
Containers
1.0 - Legacy
2.0 - Docker
3.0 - Frontend/backend separation
❶
Why containers?
Lab # 1.0 Legacy
Lab # 1.0
git checkout 1.0
git log
Lab # 1.0 Review
a. Architecture
b. Main tasks
c. Diff
d. Tricks
e. Questions?
app
runtime
OS kernel
app
runtime
OS kernel
Boundary of application packaging:
pros and cons
traditional deployment way
virtual machine
app
runtime
OS kernel
app
runtime
OS kernel
app
runtime
OS kernel
IaC (Infra as Code)
traditional deployment way
IaC tools
● Chef
● Puppet
● Ansible
virtual machine
app
runtime
OS kernel
app
runtime
OS kernel
app
runtime
OS kernel
Containers as application packaging
units
traditional deployment way
container
virtual machine
Lab # 2.0 Docker
Lab # 2.0
git checkout 2.0
git log
git diff --stat HEAD~1 HEAD
Lab # 2.0 Review
a. Architecture
b. Main tasks
c. Diff
d. Tricks
e. Questions?
Lab # 3.0 Frontend/backend separation
Lab # 3.0
git checkout 3.0
git log
git diff --stat HEAD~1 HEAD
app
runtime
OS kernel
app
runtime
OS kernel
app
runtime
OS kernel
Recap:
containers as application packaging units
traditional deployment way
container
virtual machine
Lab # 3.0 Review
a. Architecture
b. Main tasks
c. Diff
d. Tricks
e. Questions?
Kubernetes
4.0 - Local Kubernetes
4.1 - Kubernetes dashboard
5.0 - Configuration
❷
Lab material
4.0 - Local Kubernetes
4.1 - Kubernetes dashboard
5.0 - Configuration
For each revision, pay attention to:
1. image versions
2. diff in code and configuration
Kubernetes
Terminology
“Kubernetes 101: Pods, Nodes, Containers,
and Clusters”
• Author: Daniel Sanche
• Date: 2018-01-02
• URL:
https://medium.com/google-cloud/kubernetes-101-pods-nodes-c
ontainers-and-clusters-c1509e409e16
(or http://bit.ly/post-k8s-101 for short)
Container
Pod
Container
Any examples?
• Shared volumes
• IPC
• Network
https://linchpiner.github.io/k8s-multi-container-pods.html
Multi-Container Pods in Kubernetes
Pod
Container
Deployment & Replicalabel
selector
_v2
Service
label
selector
3
label
_v2
Service
container
pod
deployment
service
3
Kubernetes
Terminology
Learn by doing!
Lab material
4.0 - Local Kubernetes
4.1 - Kubernetes dashboard
5.0 - Configuration
For each revision, pay attention to:
1. image versions
2. diff in code and configuration
Lab # 4.0 Local Kubernetes
Lab # 4.0
git checkout 4.0
git log
git diff --stat HEAD~1 HEAD
Lab # 4.0 Review
a. Architecture
b. Main tasks
c. Diff
d. Tricks
e. Questions?
CAUTION
● There’s one big issue in this Lab 4.0
Can you see?
● What if a image changes but version
tag remains unchanged?
Lab # 4.1 Kubernetes dashboard
Lab # 5.0 Configuration
Lab # 5.0
git checkout 5.0
git log
git diff --stat HEAD~1 HEAD
_v2
Service
container
pod
deployment
service
Recap:
containers as application packaging units
3
Lab # 5.0 Review
a. Architecture
b. Main tasks
c. Diff
d. Tricks
e. Questions?
Cloud
6.0 - Cloud (GKE for example)
7.0 - Canary release
❸
Lab # 6.0 Cloud (GKE for example)
Lab # 6.0
git checkout 6.0
git log
git diff --stat HEAD~1 HEAD
Lab # 6.0 Review
a. Architecture
b. Main tasks
c. Diff
d. Tricks
e. Questions?
Lab # 7.0 Canary release
Lab # 7.0
git checkout 7.0
git log
git diff --stat HEAD~1 HEAD
Service
label
selector
_v2
Service
label
label
3
selector
Lab # 7.0 Review
a. Architecture
b. Main tasks
c. Diff
d. Tricks
e. Questions?
Conclusion
app
runtime
OS kernel
app
runtime
OS kernel
app
runtime
OS kernel
Recap:
containers as application packaging units
traditional deployment way
container
virtual machine
_v2
Service
container
pod
deployment
service
label
label
3
selector
Agenda
Know promising trends
Adopt gradually
Prepare mindset
Goals
Containers
Kubernetes
Cloud
Labs
1.0 — 3.0
4.0 — 5.0
6.0 — 7.0
Not told today
Session affinity
https://medium.com/@diegomrtnzg/redirect-your-users-to-the-same-pod
-by-using-session-affinity-on-kubernetes-baebf6a1733b
StatefulSet
https://godleon.github.io/blog/Kubernetes/k8s-StatefulSets-Overview
/
Persistent Volume & Claim
https://godleon.github.io/blog/Kubernetes/k8s-PersistentVolume-Over
view/
●

給 RD 的 Kubernetes 初體驗 (gcpug 2019-06 version)