Slide 1

Slide 1 text

Introduction to GitOps Deployment to Kubernetes by @sakajunquality. 10 December 2018

Slide 2

Slide 2 text

About me Jun Sakata / @sakajunquality - Google Developers Expert, Cloud - Software Engineer at Ubie inc. - From Japan - Loves: #kubernetes and #beer

Slide 3

Slide 3 text

Ubie Inc. - Medical Startup in Japan. - Diagnosis Assistance to Doctors - Production Workloads on Kubernetes + GCP - Since Oct. 2018

Slide 4

Slide 4 text

Agenda - Concept of GitOps - Very Prototype of GitOps in Ubie - Future Perspectives

Slide 5

Slide 5 text

Google Cloud Platform - As the company is using GCP, services used in the slides are products of GCP. - But the whole story and idea, I believe, can be applied to any Cloud or On-Prem.

Slide 6

Slide 6 text

Concept of GitOps

Slide 7

Slide 7 text

GitOps - Operations by Pull Request https://www.weave.works/blog/gitops-operations-by-pull-request

Slide 8

Slide 8 text

GitOps Basics - Two different types of git repository. - Application Repo: Application source code - Config Repo: Declarative manifest for configuration Application Config

Slide 9

Slide 9 text

Concept of GitOps - All the manifest is managed declaratively in Git. - Any “apply” is through CI.

Slide 10

Slide 10 text

Concept of GitOps - In Other Words... - Manifest in the Git represents the current state of the infrastructure. - Any kind of manual “apply” is prohibited.

Slide 11

Slide 11 text

Very Prototype of GitOps in Ubie

Slide 12

Slide 12 text

Infrastructure in Ubie - Several services are running on Kubernetes cluster. - Frontend - Several backend microservices - Kubernetes (in Ubie) = Google Kubernetes Engine. - All the workloads are on Google Cloud Platform. - Migrated from Heroku on Oct. 2018.

Slide 13

Slide 13 text

My GitOps Philosophy in Ubie - Workflow itself should be simple. - Each components should be decoupled. - New application should be easily integrated. (as much as possible)

Slide 14

Slide 14 text

GitOps Steps in Ubie

Slide 15

Slide 15 text

GitOps Steps in Ubie

Slide 16

Slide 16 text

GitOps Steps in Ubie

Slide 17

Slide 17 text

GitOps Steps in Ubie

Slide 18

Slide 18 text

GitOps Steps in Ubie

Slide 19

Slide 19 text

GitOps First Step

Slide 20

Slide 20 text

GitOps First Step - Commit and Push to the manifest repo manually. - Create an release Pull-Request manually. - Merge the Pull-Request to deploy.

Slide 21

Slide 21 text

GitOps First Step: Problems Obviously there are problems, - We make mistakes. - Difficult to make changes to manifest repo for engineers.

Slide 22

Slide 22 text

GitOps Second Step

Slide 23

Slide 23 text

GitOps Second Step - Commit to the manifest repo and Create an release Pull-Request automatically. - Merge the Pull Request to deploy.

Slide 24

Slide 24 text

GitOps Second Step: GitOps App - App that subscribes event from CI (Cloud Build) through MQ (Cloud Pub/Sub), - Create an Release Pull-Request on Github. - Notify the Pull-Request via Slack.

Slide 25

Slide 25 text

GitOps Second Step: GitOps App - Slack Notification After docker image is finished, Pull-Request url is notified via slack.

Slide 26

Slide 26 text

GitOps Second Step: GitOps App - Github Pull-Request Engineer just need to merge the Pull-Request.

Slide 27

Slide 27 text

GitOps Second Step: GitOps App - Rollback When you need to rollback, - Revert the merged Pull-Request. - Merge the reverted Pull-Request.

Slide 28

Slide 28 text

No manual changes to the manifest (in terms of application release)

Slide 29

Slide 29 text

GitOps Agent

Slide 30

Slide 30 text

GitOps Agent - Using custom app written in Go. - https://github.com/sakajunquality/flow - No docs at the moment... - OSS exists though. - https://github.com/weaveworks/flux

Slide 31

Slide 31 text

Example in google/go-github is helpful to create a GitOps App https://github.com/google/go-github/blob/master/example/commitpr/main.go

Slide 32

Slide 32 text

Future Perspective

Slide 33

Slide 33 text

Some Improvements from the Prototype - Support for pre/post jobs like migration. - Support for ad-hoc pre/post jobs. - Must consider rollback! - Deployment notification - Must be easy for developers. - Strategic Release - Canary Release / Release Analytics - Blue/Green - etc. Currently working on it...

Slide 34

Slide 34 text

Some Improvements from the Prototype Our pipeline is separated into two parts: Build and Apply

Slide 35

Slide 35 text

Some Improvements from the Prototype Apply Part can be replaced with more “Rich” CIs to run more complex jobs.

Slide 36

Slide 36 text

GitOps App: Sync - Currently Ops is unidirectional: Config repo to Cluster Only Config apply

Slide 37

Slide 37 text

GitOps App: Sync - Currently Ops is unidirectional: Manifest repo to Cluster Only - Considering auto-scaling or any updates within a cluster, bidirectional ops should be implemented in the future. - flux is bidirectional Config apply sync

Slide 38

Slide 38 text

Conclusion

Slide 39

Slide 39 text

Conclusion - By GitOps, workflow for Kubernetes can be simple. - GitOps can be introduced step by step. - Let’s start simply :)

Slide 40

Slide 40 text

For more info I will publish an article with more detail, and share on my twitter: @sakajunquality

Slide 41

Slide 41 text

Thank you.

Slide 42

Slide 42 text

No content