Slide 1

Slide 1 text

1 0 @ 1

Slide 2

Slide 2 text

2

Slide 3

Slide 3 text

Copyright 2019 Red Hat K.K. . ( ) . ! 3

Slide 4

Slide 4 text

Copyright 2019 Red Hat K.K. ! 4

Slide 5

Slide 5 text

Copyright 2019 Red Hat K.K. ! 5

Slide 6

Slide 6 text

l eo T i T @ N T aI F I 1 4 3 2 d N # NF T C I I T M F F 66 777 60 4. 6 2 6 46 / 1 7 60/ 66 777 60 4. 6 2 6 46 / 1 7 60/ 66 777 60 4. 6 2 6 46 / 1 7 60/ 66 777 60 4. 6 2 6 46 / 1 7 60/ 6

Slide 7

Slide 7 text

Copyright 2019 Red Hat K.K. 7

Slide 8

Slide 8 text

Copyright 2019 Red Hat K.K. 8

Slide 9

Slide 9 text

Copyright 2019 Red Hat K.K. ) ( ) https://qiita.com/capsmalt/items/496942c823f5cf0f307d 9

Slide 10

Slide 10 text

10

Slide 11

Slide 11 text

11

Slide 12

Slide 12 text

12

Slide 13

Slide 13 text

8 / / ) (/ . / @ K L I / 13

Slide 14

Slide 14 text

Cloud Native Meetup Tokyo Cloud Native Developer JP ) () ) 14

Slide 15

Slide 15 text

https://openshift.connpass.com/ OpenShift UserGroup 15

Slide 16

Slide 16 text

1 0 @ 16

Slide 17

Slide 17 text

Copyright 2019 Red Hat K.K. 17

Slide 18

Slide 18 text

Copyright 2019 Red Hat K.K. 8 K 8= C + ) + (+ + / 18

Slide 19

Slide 19 text

Copyright 2019 Red Hat K.K. 19

Slide 20

Slide 20 text

Copyright 2019 Red Hat K.K. ? 20

Slide 21

Slide 21 text

Today’s Agenda 1 2 3 Kubernetes Core Why / What Operator How to get Operator 21

Slide 22

Slide 22 text

Copyright 2019 Red Hat K.K. 22

Slide 23

Slide 23 text

Copyright 2019 Red Hat K.K. ( ) ) ) ) ) ) ) ) K ( !%$ ("' 23

Slide 24

Slide 24 text

Copyright 2019 Red Hat K.K. N M N P3 N 1 P 2 a a 24

Slide 25

Slide 25 text

Copyright 2019 Red Hat K.K. 25

Slide 26

Slide 26 text

Copyright 2019 Red Hat K.K. . 3 : ) ) ) ( ( : N 3 26

Slide 27

Slide 27 text

Copyright 2019 Red Hat K.K. 3 N ( ( : N ( 2 3 2 . ) ( ) ) ) 3 c e` c K ad b : i 3 27

Slide 28

Slide 28 text

Copyright 2019 Red Hat K.K. 28

Slide 29

Slide 29 text

Copyright 2019 Red Hat K.K. 29

Slide 30

Slide 30 text

Copyright 2019 Red Hat K.K. )( ( ) ) ) ( 30

Slide 31

Slide 31 text

Copyright 2019 Red Hat K.K. ( ( ) ( - ( ( - ) ( ) ( 31

Slide 32

Slide 32 text

Copyright 2019 Red Hat K.K. o .- . - • • . - • .- • • . • 32

Slide 33

Slide 33 text

Copyright 2019 Red Hat K.K. " - . - - - - 33

Slide 34

Slide 34 text

Copyright 2019 Red Hat K.K. 34

Slide 35

Slide 35 text

Copyright 2019 Red Hat K.K. Cloud Infrastructure Resources Hardware, Virtualization, Cloud and Service Provider Certifications CI/CD Workload Serverless Workload Machine Learning Workload IoT Workload Workload Abstraction Any Applications Resource Abstraction Any Resources Company Core Value? (*Not Kubernetes) 8 C 8 => K ) ( ) 35

Slide 36

Slide 36 text

Copyright 2019 Red Hat K.K. 36

Slide 37

Slide 37 text

Copyright 2019 Red Hat K.K. 37

Slide 38

Slide 38 text

Copyright 2019 Red Hat K.K. https://www.cncf.io/projects/ 38

Slide 39

Slide 39 text

Copyright 2019 Red Hat K.K. + + 39

Slide 40

Slide 40 text

Copyright 2019 Red Hat K.K. M DCAN I G FB 40

Slide 41

Slide 41 text

Copyright 2019 Red Hat K.K. ! 41

Slide 42

Slide 42 text

Copyright 2019 Red Hat K.K. 2 7 00 - ,2 , 0 : , 7, S 7 IE LC A S EC LCH S LMI S LCLP M CLP KK S II 1H CLH C A E LK S LH A KCKL S ,A KK A KK L A LCH S -HKL H L C A K S MCE IEHP 1 LBH HEHAP S E L H 1H CLH C A E LK S 1 L C A B A D S E L H M CLP - C A S A - C A S M CLP LC C LCH K S 2 LOH D HEC P S CK KL HN P S KHM A L LCH S IA L B S E L H IA L B S A IA L B S II IA L B S M CLP L B K S H LC MHMK M CLP C A S 1MELC NC H L HEEHML S , L I CK H L C ACKL P S EMKL II ,E KLC CLP S 1H CLH E L C L S 0HA AA A LCH c R RV g eb kl i faVh T dUYT HM 7B 2 O L D 7B L L H LB /M L K , HKPKL MAMKL & % 42

Slide 43

Slide 43 text

Copyright 2019 Red Hat K.K. / b gpim : a K a lc nhe od b k - . - // / / / - . / - - 43

Slide 44

Slide 44 text

Copyright 2019 Red Hat K.K. Cloud Infrastructure Resources Hardware, Virtualization, Cloud and Service Provider Certifications CI/CD Workload Serverless Workload Machine Learning Workload IoT Workload Workload Abstraction Any Applications Resource Abstraction Any Resources Company Core Value? (*Not Kubernetes) C V 8 => K ) ( ) 8 K C 8 44

Slide 45

Slide 45 text

Copyright 2019 Red Hat K.K. 45

Slide 46

Slide 46 text

Copyright 2019 Red Hat K.K. 46

Slide 47

Slide 47 text

Copyright 2019 Red Hat K.K. 47

Slide 48

Slide 48 text

Copyright 2019 Red Hat K.K. 8 K 8= C + ) + (+ + / 48

Slide 49

Slide 49 text

Copyright 2019 Red Hat K.K. o ) ) o o o J P ( o or 49

Slide 50

Slide 50 text

Copyright 2019 Red Hat K.K. . 4 1 o o o O o o o . o S o o o 50

Slide 51

Slide 51 text

Copyright 2019 Red Hat K.K. ● ● ● 51

Slide 52

Slide 52 text

Copyright 2019 Red Hat K.K. ) ● N ) ( P ● N ) ( P ● R ) ( O ● ) ) ) O ) ) / 52

Slide 53

Slide 53 text

Copyright 2019 Red Hat K.K. ● ()P ● ()P ● P () ● C ( () RNO ( ) ) / 53

Slide 54

Slide 54 text

Copyright 2019 Red Hat K.K. 54

Slide 55

Slide 55 text

55

Slide 56

Slide 56 text

Copyright 2019 Red Hat K.K. . . / - / - - . --. / -. / -/ 56

Slide 57

Slide 57 text

Copyright 2019 Red Hat K.K. /66 5 . 7 4. 6/ 1 6-15 . 7 4. 57

Slide 58

Slide 58 text

Copyright 2019 Red Hat K.K. : . - / 1-81 - . 1 1.. / 58

Slide 59

Slide 59 text

Copyright 2019 Red Hat K.K. G s : / - - - . : / .B/ G HP G Sb km .B/ HPon dg l pr KO - a iu . Ct efD hc . / . . A . 59

Slide 60

Slide 60 text

- . - / . / 60

Slide 61

Slide 61 text

/ - / - . ./ . . / . . . ./ . 61

Slide 62

Slide 62 text

Copyright 2019 Red Hat K.K. o P L o C L o ( R o ) / / L A o I O 62

Slide 63

Slide 63 text

Copyright 2019 Red Hat K.K. 2.3 413 D C D 1 431 .3 C 2.3 413 1 5 C5 63

Slide 64

Slide 64 text

Copyright 2019 Red Hat K.K. $ operator-sdk new memcached-operator ( ) ( . 1 64

Slide 65

Slide 65 text

Copyright 2019 Red Hat K.K. $ operator-sdk add api --api- version=cache.example.com/v1alpha1 --kind=Memcached (pkg/apis/cache/v1alpha1/memcached_types.g D A . C 2 type MemcachedSpec struct { // Size is the size of the memcached deployment Size int32 `json:"size"` } type MemcachedStatus struct { // Nodes are the names of the memcached pods // +listType=set Nodes []string `json:"nodes"` } 65

Slide 66

Slide 66 text

Copyright 2019 Red Hat K.K. ) D . $ operator-sdk generate k8s $ operator-sdk generate openapi 2 ( 2AC 66

Slide 67

Slide 67 text

Copyright 2019 Red Hat K.K. $ operator-sdk add controller --api- version=cache.example.com/v1alpha1 --kind=Memcached err := c.Watch( &source.Kind{Type: &cachev1alpha1.Memcached{}}, &handler.EnqueueRequestForObject{}, ) (pkg/controller/memcached/memcached_controlle A C . I 3 err := c.Watch( &source.Kind{Type: &appsv1.Deployment{}}, &handler.EnqueueRequestForOwner{ IsController: true, OwnerType: &cachev1alpha1.Memcached{}}, ) https://github.com/operator-framework/operato sdk/blob/master/example/memcached- operator/memcached_controller.go.tmpl 67

Slide 68

Slide 68 text

Copyright 2019 Red Hat K.K. func (r *ReconcileMemcached) Reconcile(request reconcile.Request) (reconcile.Result, error) { // Lookup the Memcached instance for this reconcile request memcached := &cachev1alpha1.Memcached{} err := r.client.Get(context.TODO(),request.NamespacedName, memcached) ... } )) . ()( ( 3 68

Slide 69

Slide 69 text

Copyright 2019 Red Hat K.K. $ operator-sdk build quay.io/capsmalt/memcached-operator:v0.0.1 )4 - C D $ docker push quay.io/capsmalt/memcached-operator:v0.0.1 serviceAccountName: memcached-operator containers: - name: memcached-operator # Replace this with the built image name image: quay.io/capsmalt/memcached-operator:v0.0.1 command: - memcached-operator imagePullPolicy: Always (deploy/operator.yaml) $ kubectl create -f deploy/crds/cache.example.com_memcacheds_crd.yaml & ( .-. 4 - C D I A 69

Slide 70

Slide 70 text

Copyright 2019 Red Hat K.K. $ kubectl create -f deploy/operator.yaml ( 4 ) BDA C $ kubectl create -f deploy/service_account.yaml $ kubectl create -f deploy/role.yaml $ kubectl create -f deploy/role_binding.yaml & C ( 4 ) . 4 C $ kubectl get deployment NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE memcached-operator 1 1 1 1 1m $ kubectl get pod NAME READY STATUS RESTARTS AGE memcached-operator-7d76948766-nrcp7 1/1 Running 0 1m 70

Slide 71

Slide 71 text

Copyright 2019 Red Hat K.K. apiVersion: "cache.example.com/v1alpha1" kind: "Memcached" metadata: name: "example-memcached" spec: size: 3 (deploy/crds/cache.example.com_v1alpha1_Memcached_cr.yaml) $ kubectl apply -f deploy/crds/cache.example.com_v1alpha1_memcached_cr.yaml 71

Slide 72

Slide 72 text

Copyright 2019 Red Hat K.K. D .)() 5 1 . C $ kubectl get deployment NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE memcached-operator 1 1 1 1 2m example-memcached 3 3 3 3 1m $ kubectl get pods NAME READY STATUS RESTARTS AGE example-memcached-5cc7c78d6-g6h6d 1/1 Running 0 2m example-memcached-5cc7c78d6-g5k7v 1/1 Running 0 2m example-memcached-5cc7c78d6-m7vn7 1/1 Running 0 2m memcached-operator-7gd6csgfd6-vvjqk 1/1 Running 0 3m 72

Slide 73

Slide 73 text

Copyright 2019 Red Hat K.K. ( 53- 2 . ( ) apiVersion: "cache.example.com/v1alpha1" kind: "Memcached" metadata: name: "example-memcached" spec: size: 5 $ kubectl apply -f deploy/crds/cache.example.com_v1alpha1_memcached_cr.yaml $ kubectl get deployment NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE example-memcached 5 5 5 5 10m 73

Slide 74

Slide 74 text

Copyright 2019 Red Hat K.K. $ operator-sdk new memcached-operator \ --api-version=cache.example.com/v1alpha1 \ --kind=Memcached --type=ansible Creates: ● Ansible Role ● Mapping File (watches.yaml) ● Custom Resource Definition ● Deploy manifest for the new Operator # watches.yaml --- - version: v1alpha1 group: cache.example.com kind: Memcached playbook: /path/to/playbook 74

Slide 75

Slide 75 text

Copyright 2019 Red Hat K.K. / .- ./ . - . ./ . -/ - . - - ./ . 75

Slide 76

Slide 76 text

1 - ) ( -- - . / . 76

Slide 77

Slide 77 text

/- / / . /. . - 77

Slide 78

Slide 78 text

- ) ( . 78

Slide 79

Slide 79 text

Copyright 2019 Red Hat K.K. / . ./ - . - ./ . / 79

Slide 80

Slide 80 text

) (. 80

Slide 81

Slide 81 text

Copyright 2019 Red Hat K.K. . . , , - . . . - h yb , O fc HGu d sp t glrn 4 . . K A m w e AW RM i S a W AW o 81

Slide 82

Slide 82 text

Copyright 2019 Red Hat K.K. / / / / / / 82

Slide 83

Slide 83 text

Copyright 2019 Red Hat K.K. 83

Slide 84

Slide 84 text

Copyright 2019 Red Hat K.K. . ./ 84

Slide 85

Slide 85 text

Copyright 2019 Red Hat K.K. 85

Slide 86

Slide 86 text

Copyright 2019 Red Hat K.K. A L H I , ( , (( , ((( , (/ , / ( A BA A A B A A , A B B A B ) A B B ( A A A D BA , A F A A BA AB A A B AB 41 $+) /$.'/ 5092 "=3& !)/ $ -=3 % !$41+ !+ - ;: <$+ )/*# , % '+* ./ % 41 , ,$ ( />86 7(+/ % 86

Slide 87

Slide 87 text

Copyright 2019 Red Hat K.K. 87

Slide 88

Slide 88 text

Copyright 2019 Red Hat K.K. + 88

Slide 89

Slide 89 text

Copyright 2019 Red Hat K.K. ( ) + = “create new operator” Kubernetes Operator Operator SDK DEV Deployment Role ClusterRole RoleBinding ClusterRoleBinding ServiceAccount CustomResourceDefinition 89

Slide 90

Slide 90 text

Copyright 2019 Red Hat K.K. ( ) + = “create new operator” + Kubernetes Operator Operator SDK DEV 90

Slide 91

Slide 91 text

Copyright 2019 Red Hat K.K. ) ( ( ) ( ( 91

Slide 92

Slide 92 text

- . - / . / 92

Slide 93

Slide 93 text

Copyright 2019 Red Hat K.K. . E = D / + + D 93

Slide 94

Slide 94 text

Copyright 2019 Red Hat K.K. ( ) 94

Slide 95

Slide 95 text

Copyright 2019 Red Hat K.K. < - - + . + . - - - $ :- - : - - .+ . . . + R A NEI M ID E += ./ = A N - - - - - $ - - - - + +/. > - - 95

Slide 96

Slide 96 text

Copyright 2019 Red Hat K.K. A . / . = = . / = / A/ = = U RS DI E M N = D I A = / / = + 96

Slide 97

Slide 97 text

Copyright 2019 Red Hat K.K. ) ( -( C E C : A ) A DDD C E I S C E C : A ) Q N TM - ) ( -( c ye / A hl / A ye e g P : Aa / A ye Q / A ye Q s c / A ye Qu i V O / A w Poe / A ye t l ud g . p / A Q i r e ng g , C . : C . : s m . J Q LO M s m C E :A CA . C ( :A / A 97

Slide 98

Slide 98 text

Copyright 2019 Red Hat K.K. 2 3 13 2 3 13 2 3 13 2 3 13 2 3 13 3.2 .10 2 3 13 . 0 3 98

Slide 99

Slide 99 text

Copyright 2019 Red Hat K.K. Automated Dependency Resolution My Operator v1.1.2 require s requires Jaeger Operator jaeger.jaegertracing.io /v1 CockroachDB Operator cockroachdb.charts.helm.k8s.io/v1alpha 1 resolves to resolves to Operator Framework installed by installed by 99

Slide 100

Slide 100 text

Copyright 2019 Red Hat K.K. 100

Slide 101

Slide 101 text

Copyright 2019 Red Hat K.K. 8 K 8= C + ) + (+ + / 101

Slide 102

Slide 102 text

Copyright 2019 Red Hat K.K. ) ( ) ) ) ). 102

Slide 103

Slide 103 text

Copyright 2019 Red Hat K.K. 103

Slide 104

Slide 104 text

Copyright 2019 Red Hat K.K. 104

Slide 105

Slide 105 text

105

Slide 106

Slide 106 text

106