Slide 1

Slide 1 text

Masaya Aoyama CyberAgent adtech studio Cloud Native࣌୅ʹ͓͚Δ Docker / Kubernetes ʹΑΔ։ൃ Developers Summit 2019 at 02/14 ࢿྉ: http://bit.ly/devsumi 2019 k8s MasayaAoyama @amsy810 Masaya Aoyama CyberAgent adtech studio Cloud Native࣌୅ʹ͓͚Δ Docker / Kubernetes ʹΑΔ։ൃ Developers Summit 2019 at 02/14 MasayaAoyama @amsy810

Slide 2

Slide 2 text

$58'B@-9C Kubernetes )" ;: Japan Container Days v18.04 Keynote ,(! .+=4 AWS Dev Day TokyoIBM Think Japan CKA #138CKAD #2 Masaya Aoyama (@amsy810) Infrastructure Engineer Co-chair - Cloud Native Days Tokyo B0 Japan Container DaysC Organizer - Cloud Native Meetup Tokyo Organizer - Kubernetes Meetup Tokyo Organizer - KubeCon /1 3! Contribute to OpenStack and Kubernetes 2% KaaS *< / ?7 K8s A>

Slide 3

Slide 3 text

Kubernetes

Slide 4

Slide 4 text

Instagramable Kubernetes K

Slide 5

Slide 5 text

Agenda • Cloud Native and Kubernetes • Microservice and Service Mesh • Container and Docker • Kubernetes Overview • What is doing Kubernetes • Kubernetes is Framework and Distributed System • CI/CD with Kubernetes/Docker • Future of Kubernetes

Slide 6

Slide 6 text

Cloud Native and Kubernetes What is Kubernetes? What is Cloud Naitve?

Slide 7

Slide 7 text

CNCF and The Linux Foundation • KubernetesThe Linux Foundation CNCF •

Slide 8

Slide 8 text

Cloud Native Cloud native technologies empower organizations to build and run scalable applications in modern, dynamic environments such as public, private, and hybrid clouds. Containers, service meshes, microservices, immutable infrastructure, and declarative APIs exemplify this approach. These techniques enable loosely coupled systems that are resilient, manageable, and observable. Combined with robust automation, they allow engineers to make high-impact changes frequently and predictably with minimal toil. The Cloud Native Computing Foundation seeks to drive adoption of this paradigm by fostering and sustaining an ecosystem of open source, vendor-neutral projects. We democratize state-of-the-art patterns to make these innovations accessible for everyone. CNCF Cloud Native Defenition v1.0, CNCF, 2018-11-28 (https://github.com/cncf/toc/blob/master/DEFINITION.md)

Slide 9

Slide 9 text

Cloud Native8 Cloud native technologies empower organizations to build and run scalable applications in modern, dynamic environments such as public, private, and hybrid clouds. Containers, service meshes, microservices, immutable infrastructure, and declarative APIs exemplify this approach. These techniques enable loosely coupled systems that are resilient, manageable, and observable. Combined with robust automation, they allow engineers to make high-impact changes frequently and predictably with minimal toil. The Cloud Native Computing Foundation seeks to drive adoption of this paradigm by fostering and sustaining an ecosystem of open source, vendor-neutral projects. We democratize state-of-the-art patterns to make these innovations accessible for everyone. CNCF Cloud Native Defenition v1.0, CNCF, 2018-11-28 (https://github.com/cncf/toc/blob/master/DEFINITION.md) • .0 • & • /- • 4* • +3 71 )%5 ($6 "!'2 Open Scalable#,

Slide 10

Slide 10 text

Kubernetes is key product for Cloud Native Computing Cloud Native Ecosystem

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

Cloud Native

Slide 13

Slide 13 text

Microservice and Service Mesh Benefit of Microservice and Service Mesh • • • • •

Slide 14

Slide 14 text

Microservice Architecture ProductPage Reviews Details Ratings HTTP/gRPC HTTP/gRPC HTTP/gRPC Bookinfo Application, Istio, 2018-11-28 (https://istio.io/docs/examples/bookinfo/)

Slide 15

Slide 15 text

%' )#!D@X_71T gRPC, REST N%' )#!cS 2 )#!@X_7UJ<f "$'9A : CT/*"$'1T f^=eO4; 6YBbK-^ 2`aG7%' )#!bK,+?M CT\-E[L !)&(9A G7CT!)&( .IV d8,+F0 G7CTd8Z 53 R] H> )#!PQW Benefit of Microservice Golang Java Scala gRPC REST

Slide 16

Slide 16 text

%' )#!D@X_71T gRPC, REST N%' )#!cS 2 )#!@X_7UJ<f "$'9A : CT/*"$'1T f^=eO4; 6YBbK-^ 2`aG7%' )#!bK,+?M CT\-E[L !)&(9A G7CT!)&( .IV d8,+F0 G7CTd8Z 53 R] H> )#!PQW Developer Benefit of Microservice

Slide 17

Slide 17 text

%' )#!D@X_71T gRPC, REST N%' )#!cS 2 )#!@X_7UJ<f "$'9A : CT/*"$'1T f^=eO4; 6YBbK-^ 2`aG7%' )#!bK,+?M CT\-E[L !)&(9A G7CT!)&( .IV d8,+F0 G7CTd8Z 53 R] H> )#!PQW Benefit of Microservice

Slide 18

Slide 18 text

%' )#!D@X_71T gRPC, REST N%' )#!cS 2 )#!@X_7UJ<f "$'9A : CT/*"$'1T f^=eO4; 6YBbK-^ 2`aG7%' )#!bK,+?M CT\-E[L !)&(9A G7CT!)&( .IV d8,+F0 G7CTd8Z 53 R] H> )#!PQW Benefit of Microservice

Slide 19

Slide 19 text

%' )#!D@X_71T gRPC, REST N%' )#!cS 2 )#!@X_7UJ<f "$'9A : CT/*"$'1T f^=eO4; 6YBbK-^ 2`aG7%' )#!bK,+?M CT\-E[L !)&(9A G7CT!)&( .IV d8,+F0 G7CTd8Z 53 R] H> )#!PQW Benefit of Microservice

Slide 20

Slide 20 text

500+ microservices The Case of Chaos, Bruce Wong, 2014-12-19, (https://www.slideshare.net/BruceWong3/the-case-for-chaos) The History of the Service Mesh, The New Stack, 2018-2-13, (https://thenewstack.io/history-service-mesh/)

Slide 21

Slide 21 text

500+ microservices The Case of Chaos, Bruce Wong, 2014-12-19, (https://www.slideshare.net/BruceWong3/the-case-for-chaos) The History of the Service Mesh, The New Stack, 2018-2-13, (https://thenewstack.io/history-service-mesh/) Can we get Observability?

Slide 22

Slide 22 text

Service Mesh Architecture (generally) • Microservice • Microservice with Service Mesh Proxy App a Proxy App b Proxy App c App a App b App c

Slide 23

Slide 23 text

Service Mesh • Microservice Proxy App a Proxy App b Proxy App c

Slide 24

Slide 24 text

Service Mesh • Traffic Shifting (ex, Canary release) Proxy App a Proxy App b1 Proxy App b2 99 % 1 %

Slide 25

Slide 25 text

Service Mesh • Circuit Break • Fault Injection • Rate Limit • Retry • mTLS Proxy App a Proxy App b Proxy App c #%!$ &) , *'( +")

Slide 26

Slide 26 text

Microservice / Service Mesh Microservice.H:LB7&=, 2O16()FPN0Q Service Mesh #@ … • Microservice M )I;5C 9J K!$3/> 8*(/> • AE+ • 4"% • D? • )I; • -< G'(

Slide 27

Slide 27 text

Micro Service VM …

Slide 28

Slide 28 text

Container / Docker Benefit of Container / Docker • • •

Slide 29

Slide 29 text

Container System Container • KVMXen • init Application Container • •

Slide 30

Slide 30 text

Docker • Docker4%Application Container .71-+8$! • #DevOps/# 2: /3 6)*5 • 0, Moby" &9 # containerd ('

Slide 31

Slide 31 text

Dockerfile Docker Image FROM centos:7 RUN yum -y install epel-release RUN yum -y install nginx COPY nginx.conf /etc/nginx/ ENTRYPOINT ["nginx", "-g", "daemon off;"] Build Once, Run Anywhere Docker Image Dockerfile

Slide 32

Slide 32 text

$ docker build . -t sample-image Sending build context to Docker daemon 252.9kB Step 1/5 : FROM centos:7 ---> 75835a67d134 75835a67d134 sample-image

Slide 33

Slide 33 text

$ docker build . -t sample-image Sending build context to Docker daemon 252.9kB Step 1/5 : FROM centos:7 ---> 75835a67d134 Step 2/5 : RUN yum -y install epel-release ---> Running in 9db248fc7b9a ... Removing intermediate container 9db248fc7b9a ---> 2fe5a7f8c007 75835a67d134 2fe5a7f8c007 sample-image

Slide 34

Slide 34 text

$ docker build . -t sample-image Sending build context to Docker daemon 252.9kB Step 1/5 : FROM centos:7 ---> 75835a67d134 Step 2/5 : RUN yum -y install epel-release ---> Running in 9db248fc7b9a ... Removing intermediate container 9db248fc7b9a ---> 2fe5a7f8c007 Step 3/5 : RUN yum -y install nginx ---> Running in 0547bd920b0a ... Removing intermediate container 0547bd920b0a ---> 843b47a96c5e 75835a67d134 2fe5a7f8c007 843b47a96c5e sample-image

Slide 35

Slide 35 text

$ docker build . -t sample-image Sending build context to Docker daemon 252.9kB Step 1/5 : FROM centos:7 ---> 75835a67d134 Step 2/5 : RUN yum -y install epel-release ---> Running in 9db248fc7b9a ... Removing intermediate container 9db248fc7b9a ---> 2fe5a7f8c007 Step 3/5 : RUN yum -y install nginx ---> Running in 0547bd920b0a ... Removing intermediate container 0547bd920b0a ---> 843b47a96c5e Step 4/5 : COPY nginx.conf /etc/nginx/ ---> fe63b2d4c95d 75835a67d134 2fe5a7f8c007 843b47a96c5e fe63b2d4c95d sample-image

Slide 36

Slide 36 text

$ docker build . -t sample-image Sending build context to Docker daemon 252.9kB Step 1/5 : FROM centos:7 ---> 75835a67d134 Step 2/5 : RUN yum -y install epel-release ---> Running in 9db248fc7b9a ... Removing intermediate container 9db248fc7b9a ---> 2fe5a7f8c007 Step 3/5 : RUN yum -y install nginx ---> Running in 0547bd920b0a ... Removing intermediate container 0547bd920b0a ---> 843b47a96c5e Step 4/5 : COPY nginx.conf /etc/nginx/ ---> fe63b2d4c95d Step 5/5 : ENTRYPOINT ["nginx", "-g", "daemon off;"] ---> Running in 876ee4d29339 Removing intermediate container 876ee4d29339 ---> b5068171c053 75835a67d134 2fe5a7f8c007 843b47a96c5e fe63b2d4c95d b5068171c053 sample-image

Slide 37

Slide 37 text

Docker • • Read Write • Read Only

Slide 38

Slide 38 text

5: ENTRYPOINT [”/usr/sbin/nginx", "-g", "daemon off;"] 5: ENTRYPOINT [”nginx", "-g", "daemon off;"]

Slide 39

Slide 39 text

Ref: https://docs.docker.com/develop/develop-images/dockerfile_best-practices/ Ref: https://12factor.net/ B*=C Part of Docker Container Best Practice • @(1 • "3< $1BImmutable InfrastructureC • A;8, / 4:8,+" !'9 • #0> !& • 59)?.%8,-2 / 7 • 6 • etc

Slide 40

Slide 40 text

Container / Docker VM0… • #(+. • 7':8 • ##, • /6 %9;=">=!< • Immutable Infrastructure *1 • 35) • -$& • 42

Slide 41

Slide 41 text

Slide 42

Slide 42 text

Kubernetes Overview Promote Cloud Native • • • • •

Slide 43

Slide 43 text

Docker Swarm mode Container Orchestration Engine

Slide 44

Slide 44 text

Container Orchestration Engine (4/0 • 3*Docker2/ • # $ # • $ # / $ $ # • "$ # $ • #-.15 • 6&+!$ # • $ • "$# # • $,')%2/

Slide 45

Slide 45 text

Container Orchestration Engine CYOP • XE Docker*" SO • 1 $ ,2.1 • 2.1 / 2"2.1 • 02.1)!2" • 1 $ KLRZ • ^>F /(&2.1 • 2'!%. • 02#%-11 • !2J?D; SO Container Orchestration Engine CYOP • QT9 + • B34 • SO • 8[M • :NW67_U IA \H@] 54 =

Slide 46

Slide 46 text

CNCFStandardization 01. " (!) OCI v1.0 02. # CRI 03. # CSI 04. # CNI

Slide 47

Slide 47 text

Kubernetes Docker Kubernetes • CRI • docker • cri-o • containerd OCI • runC • gVisor • Kata Containers • Nabla Containers • Firecracker # )! '( $"&%

Slide 48

Slide 48 text

What is doing Kubernetes? Declarative Code & APIs Self-Healing Automation & Immutable Infrastructure

Slide 49

Slide 49 text

Kubernetes Design Principles, Kubernetes Community, 2017-11-04 (https://github.com/kubernetes/community/blob/master/contributors/design-proposals/architecture/principles.md) 02 03 01 Self Healing ) #" Automation & Immutable Infrastructure Immutable Infrastructure& # Declarative Code & API Manifests$" %'API !( Infrastructure as Code

Slide 50

Slide 50 text

Declarative Code and APIs Developer Register YAML Manifest Kubernetes Cluster Manifests API Infrastructure as Code $ kubectl apply –f manifest.yaml

Slide 51

Slide 51 text

Pod

Slide 52

Slide 52 text

Load Balancer

Slide 53

Slide 53 text

ReplicaSet Self-Healing • ReplicaSet Replica • = Node Node

Slide 54

Slide 54 text

ReplicaSet Rolling Update (Automation) • #%"$ /) • $!% % • Immutable Infrastructure • #%"$ .& Load Balancer Developer (, '* Deployment+-

Slide 55

Slide 55 text

ReplicaSet Rolling Update (Automation) • • • Immutable Infrastructure • Load Balancer

Slide 56

Slide 56 text

ReplicaSet Rolling Update (Automation) • • • Immutable Infrastructure • Load Balancer

Slide 57

Slide 57 text

ReplicaSet Rolling Update (Automation) • • • Immutable Infrastructure • Load Balancer

Slide 58

Slide 58 text

Key points • KubernetesGoogle=/A3. + #(&$,'Borg%,OSS1 → ;*,),"25<>1 ?01846 • 7@1 $!*,9-YAML: → Infrastructure EngineerBOpsC. Server-side Engineer BDevC.

Slide 59

Slide 59 text

Kubernetes is Framework and Distributed System Custom Resource Definition

Slide 60

Slide 60 text

Kubernetes Developer

Slide 61

Slide 61 text

Kubernetes Developer !!! ! !

Slide 62

Slide 62 text

Kubernetes Developer !$ % % %%% 1. " 2. # 3. → Control Loop

Slide 63

Slide 63 text

… Developer -1 0+) &' ) ! ) 1. +*# .( 2. +*#,"*# %/ 3. , $ → Control Loop

Slide 64

Slide 64 text

ReplicaSet *2+ Developer 18 Pod (36 #4 $Pod '9 Pod '9 1. / .&5- 2. / .&0%.&,7 3. " ! 0 ) → Control Loop

Slide 65

Slide 65 text

Custom Resource Definition Developer 1. 2. 3. → Control Loop

Slide 66

Slide 66 text

Custom Resource Definition Developer

Slide 67

Slide 67 text

Custom Resource Definition Developer Kubernetes Pod Queue

Slide 68

Slide 68 text

Kubernetes is more extensible C A D C DBC B DA C A C A A F A D2 F C C BB & A BB C A C A C DBC A & A C 2 A CB A A A & B A AD B &B C D C C DC C C 2 Kubernetes Boring Kubernetes

Slide 69

Slide 69 text

Kubernetes is more extensible B C B CAB A C 2 B B AA & AA 2F B B B D CAB & D 2 B 2BA D 2 & A C A2 &A B C B B 2F CB B B

Slide 70

Slide 70 text

CI/CD with Kubernetes / Docker How to build a CI/CD Pipelines?

Slide 71

Slide 71 text

GitOps Overview CI CD Kubernetes D Developer GitOps, Weaveworks, 2018-11-28 (https://www.weave.works/technologies/gitops/)

Slide 72

Slide 72 text

GitOps – PR CD Kubernetes

Slide 73

Slide 73 text

GitOps - Staging (staging) CI CD Staging D Developer staging branch master branch (production) Production

Slide 74

Slide 74 text

GitOps - Production (staging) CI CD D Developer staging branch master branch (production) Staging Production

Slide 75

Slide 75 text

GitOps (staging) CI CD Developer staging branch master branch (production) Staging T Production R R S !$%& # " $ E E R R S ""%& !%&

Slide 76

Slide 76 text

Future of Kubernetes Kubernetes is becoming de-facto standard in the future?

Slide 77

Slide 77 text

KubeCon + CloudNativeCon KubeCon + CloudNativeCon Barcelona 2019 Call for Proposals (CFP) Is Open, CNCF, 2018-11-28 (https://www.cncf.io/blog/2018/11/16/kubecon-barcelona-2019-call-for-proposals-cfp-is-open/)

Slide 78

Slide 78 text

Google Kubernetes Engine Managed Kubernetes Serivce Azure Kubernetes Service 2014-11 2017-02 2017-11 Amazon Elastic Container Service for Kubernetes

Slide 79

Slide 79 text

Kubernetes for Enterprise • Monzo Bank • Kubernetes + Linkerd (Service Mesh) Building a Modern Bank Backend, Monzo Bank Ltd, 2018-11-28 (https://monzo.com/blog/2016/09/19/building-a-modern-bank-backend/)

Slide 80

Slide 80 text

CNCFStandardization 01. " (!) OCI v1.0 02. # CRI 03. # CSI 04. # CNI

Slide 81

Slide 81 text

CNCF Community Presentation, CNCF, 2018 (https://github.com/cncf/presentations)

Slide 82

Slide 82 text

Kubernetes

Slide 83

Slide 83 text

3 I H uNs P /D 6 IBK c a io sy P 0 C 1 DD 3 I H W3 I HS M 3 I H & 72 uNs C ID 9 CD H uNs 0BH K L 4 uNs / B 8I uNs /D HI uNs 5 I I uNs uNs N snN s h l o y f fl y s N snr N tk ye & hs c N uNsu ghd v o y /2 /0 fl N s 8 KB 5 HA 3 I H dNkyl 3 I H b

Slide 84

Slide 84 text

https://bit.ly/cndt2019cfp Cloud Native Days Tokyo : Japan Container Days @amsy810 CFP

Slide 85

Slide 85 text

Thank you for your attention follow me: @amsy810