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://www.zaizi.com/devops

Great

Poor

Dev

Ops

https://commons.wikimedia.org/wiki/File: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

(人月神话)

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

semver

(Semantic Versioning)

4 . 14 . 1

compatible

new feature

non-compatible

hot-fix

Who use git flow?

Gitlab CI

https://about.gitlab.com/2016/08/26/ci-deployment-and-environments/

What's CI/CD?

  • Continuous Integration

  • Continuous Delivery

  1. TDD / BDD

  2. Mock / Stub

  3. Refactoring

  4. Test Coverage

  5. Test for failure

Other Method

  1. e2e testing

  2. A / B Test

  3. Canary release

  4. Blue / Green Release

  5. Nightly Build

Final Target

  1. Auto Test

  2. Auto Deploy

  3. Faster Coding, Less Bug

  4. CaaS (Code as a Service)

  5. Rolling Update / Rollback

  6. 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

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

So, what's Docker?

So, what's Docker?

So, what's Docker?

So, what's Docker?

So, what's Docker?

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

How to deploy

All pods in Kubernetes

Gitlab CI/CD Pipeline

https://about.gitlab.com/2016/08/26/ci-deployment-and-environments/

Gitlab CI/CD Pipeline

https://about.gitlab.com/2016/08/26/ci-deployment-and-environments/

Gitlab CI/CD Pipeline

https://about.gitlab.com/2016/08/26/ci-deployment-and-environments/

Gitlab CI/CD Pipeline

https://about.gitlab.com/2016/08/26/ci-deployment-and-environments/

Gitlab CI/CD Pipeline

https://about.gitlab.com/2016/08/26/ci-deployment-and-environments/

Gitlab CI/CD Pipeline

https://about.gitlab.com/2016/08/26/ci-deployment-and-environments/

Gitlab CI/CD Pipeline

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

Gitlab CI/CD Pipeline

todo: .gitlab-ci.yaml

todo: runner、running dashboard

Gitlab CI/CD Pipeline

todo: pipeline

Gitlab CI/CD Pipeline

todo: environment

Gitlab CI/CD Pipeline

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

  • 774