DevOps
Implement by Kubernetes
https://slides.com/rockwyc992/devops
Agenda
-
What's DevOps?
-
What's Kubernetes?
-
How to use them together?
Why do I use DevOps?
常見的開發情況
-
我的電腦可以跑,為什麼你的不行?
-
不知道剛剛改了什麼,程式就壞掉了
-
需.求.變.更 => 大.災.難
常見的維運情況
-
為什麼你的電腦可以跑,我的卻不行?
-
不知道怎麼安裝,或是安全性問題一大堆
-
這是上個月安裝的,我已經忘記怎麼安裝了
常見的各種情況
-
不敢重開機、不敢升級
-
缺乏測試,Bug 滿天飛
What's DevOps?
-
Developer
-
Operator
Developer + Operator = DevOps
who write & debug program
who build & install program
https://commons.wikimedia.org/wiki/File:Devops.svg
![](https://s3.amazonaws.com/media-p.slid.es/uploads/460630/images/4326265/devops-unified-workflow.png)
https://www.zaizi.com/devops
Great
Poor
Dev
Ops
https://commons.wikimedia.org/wiki/File:Agile-vs-iterative-flow.jpg
![](https://s3.amazonaws.com/media-p.slid.es/uploads/460630/images/4326321/Agile-vs-iterative-flow.jpg)
How to improve our workflow?
-
Git Flow
-
Gitlab CI
-
[WIP] Unit Test
-
Prometheus / fluentd
Monitor
Code
Build, Release, Deploy
Test
The Mythical Man-Month
http://www.books.com.tw/products/0010254508
No Silver Bullet
![](https://s3.amazonaws.com/media-p.slid.es/uploads/460630/images/4376286/moon-man.jpg)
(人月神话)
A story about baking cake
http://www.infoq.com/cn/articles/delivering-software-water-scrum-fall
Water Scrum Fall
Seems like Sliver Bullet
-
OOP
-
MVC
-
Agile
-
Docker
Why Git Flow?
branching model for git
![](https://s3.amazonaws.com/media-p.slid.es/uploads/460630/images/4329718/GitFlowFeatureBranches.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/460630/images/4329717/GitFlowDevelopBranch.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/460630/images/4329721/GitFlowReleaseBranch.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/460630/images/4329720/GitFlowMasterBranch.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/460630/images/4329719/GitFlowHotfixBranch.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/460630/images/4329719/GitFlowHotfixBranch.png)
semver
(Semantic Versioning)
4 . 14 . 1
compatible
new feature
non-compatible
hot-fix
Who use git flow?
Gitlab CI
![](https://s3.amazonaws.com/media-p.slid.es/uploads/460630/images/4326248/gitlab-oo.png)
https://about.gitlab.com/2016/08/26/ci-deployment-and-environments/
What's CI/CD?
-
Continuous Integration
-
Continuous Delivery
-
TDD / BDD
-
Mock / Stub
-
Refactoring
-
Test Coverage
-
Test for failure
Other Method
-
e2e testing
-
A / B Test
-
Canary release
-
Blue / Green Release
-
Nightly Build
Final Target
-
Auto Test
-
Auto Deploy
-
Faster Coding, Less Bug
-
CaaS (Code as a Service)
-
Rolling Update / Rollback
-
High Avilible / Auto Healing
Before we go ahead
What's Kubernetes?
What's Kubernetes
Kubernetes is an open source system for managing Docker across multiple hosts.
A Project of CNCF
![](https://s3.amazonaws.com/media-p.slid.es/uploads/460630/images/4332215/pasted-from-clipboard.png)
What's Kubernetes
Kubernetes is an open source system for managing Docker across multiple hosts.
-
Docker
-
Micro-service / Stateless
-
Multi-host
-
Self-healing
-
Rolling Update
-
Open Source (Apache 2.0)
Rolling Update
https://www.slideshare.net/DanielSmith272/whats-new-in-kubernetes
![](https://s3.amazonaws.com/media-p.slid.es/uploads/460630/images/4381544/whats-new-in-kubernetes-41-638.jpg)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/460630/images/4381545/whats-new-in-kubernetes-43-638.jpg)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/460630/images/4381546/whats-new-in-kubernetes-44-638.jpg)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/460630/images/4381547/whats-new-in-kubernetes-45-638.jpg)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/460630/images/4381548/whats-new-in-kubernetes-46-638.jpg)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/460630/images/4381549/whats-new-in-kubernetes-47-638.jpg)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/460630/images/4381550/whats-new-in-kubernetes-48-638.jpg)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/460630/images/4381551/whats-new-in-kubernetes-49-638.jpg)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/460630/images/4381552/whats-new-in-kubernetes-50-638.jpg)
So, what's Docker?
![](https://s3.amazonaws.com/media-p.slid.es/uploads/460630/images/4334114/Container_2x.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/460630/images/4334117/VM_2x.png)
So, what's Docker?
![](https://s3.amazonaws.com/media-p.slid.es/uploads/460630/images/4334128/docker-vm-container.png)
So, what's Docker?
![](https://s3.amazonaws.com/media-p.slid.es/uploads/460630/images/4334116/Pulls-Chart.png)
So, what's Docker?
![](https://s3.amazonaws.com/media-p.slid.es/uploads/460630/images/4386496/new.png)
So, what's Docker?
![](https://s3.amazonaws.com/media-p.slid.es/uploads/460630/images/4334121/2017-11-15_10-17-03______.png)
Docker
- Execute Faster
- Launch Faster
- Less Disk & Less Memory
- Scale up quickly
- More compatibility
- RestAPI
- OpenSouce (Apache 2.0)
VM
- Easy to use
- Easy to debug
- Easy to design
- More secure
- Keep all change
Kubernetes Architecture
Kubernetes Architecture
![](https://s3.amazonaws.com/media-p.slid.es/uploads/460630/images/4332439/Architecture.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/460630/images/4332440/Todo.png)
How to deploy
All pods in Kubernetes
![](https://s3.amazonaws.com/media-p.slid.es/uploads/460630/images/4331599/kube_all_pod.png)
Gitlab CI/CD Pipeline
![](https://s3.amazonaws.com/media-p.slid.es/uploads/460630/images/4330153/13.jpg)
https://about.gitlab.com/2016/08/26/ci-deployment-and-environments/
Gitlab CI/CD Pipeline
![](https://s3.amazonaws.com/media-p.slid.es/uploads/460630/images/4330154/14.jpg)
https://about.gitlab.com/2016/08/26/ci-deployment-and-environments/
Gitlab CI/CD Pipeline
![](https://s3.amazonaws.com/media-p.slid.es/uploads/460630/images/4330156/15.jpg)
https://about.gitlab.com/2016/08/26/ci-deployment-and-environments/
Gitlab CI/CD Pipeline
![](https://s3.amazonaws.com/media-p.slid.es/uploads/460630/images/4330155/16.jpg)
https://about.gitlab.com/2016/08/26/ci-deployment-and-environments/
Gitlab CI/CD Pipeline
![](https://s3.amazonaws.com/media-p.slid.es/uploads/460630/images/4330158/17.jpg)
https://about.gitlab.com/2016/08/26/ci-deployment-and-environments/
Gitlab CI/CD Pipeline
![](https://s3.amazonaws.com/media-p.slid.es/uploads/460630/images/4330157/18.jpg)
https://about.gitlab.com/2016/08/26/ci-deployment-and-environments/
Gitlab CI/CD Pipeline
![](https://s3.amazonaws.com/media-p.slid.es/uploads/460630/images/4330159/19.jpg)
Gitlab CI/CD Pipeline
https://about.gitlab.com/2016/08/26/ci-deployment-and-environments/
What have we done?
Gitlab CI/CD Pipeline
todo: .gitlab-ci.yaml
![](https://s3.amazonaws.com/media-p.slid.es/uploads/460630/images/4331974/pasted-from-clipboard.png)
Gitlab CI/CD Pipeline
todo: .gitlab-ci.yaml
![](https://s3.amazonaws.com/media-p.slid.es/uploads/460630/images/4356705/2017-11-21_10-06-25______.png)
todo: runner、running dashboard
Gitlab CI/CD Pipeline
![](https://s3.amazonaws.com/media-p.slid.es/uploads/460630/images/4331770/pasted-from-clipboard.png)
todo: pipeline
Gitlab CI/CD Pipeline
![](https://s3.amazonaws.com/media-p.slid.es/uploads/460630/images/4331717/pasted-from-clipboard.png)
todo: environment
Gitlab CI/CD Pipeline
![](https://s3.amazonaws.com/media-p.slid.es/uploads/460630/images/4331731/pasted-from-clipboard.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/460630/images/4331735/pasted-from-clipboard.png)
Example
Summy
- Change the habit with coding & pushing code.
- Just copy the file at Kubernetes-CI into your code.
All magic things will be done by Gitlab CI & Kubernetes.
- TDD / BDD for your code. It would do more job now,
but it will let you do less job at the future.
Have we done all things?
I have done the job to "use" Kubernetes.
But, I will do the job to "customize" Kubernetes.
or "contribute"
Q&A
Thanks
for your attention!
DevOps
By rockwyc992
DevOps
- 788