Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Operator reading and writing with Operator SDK

Sponsored · Ship Features Fearlessly Turn features on and off without deploys. Used by thousands of Ruby developers.
Avatar for loftkun loftkun
January 17, 2020

Operator reading and writing with Operator SDK

2020/01/17 #ふくばねてす node-3 - connpass
https://fukubernetes.connpass.com/event/159429/

image quality is low because of upload size limits , so I recommend to look at slideshare below.

slideshare : Operator reading and writing ( Operator SDK 編 )
https://www.slideshare.net/ssuserb989ce/operator-reading-and-writing-operator-sdk

Avatar for loftkun

loftkun

January 17, 2020
Tweet

More Decks by loftkun

Other Decks in Technology

Transcript

  1. About Me @loftkun ( _F G7 ) èáòP2 j ÑòàÔãêÙÜáËòæNŒ

    20191b)D : 10 ¹¡¸µ¯§d #¹¡¸µ¯§ node-1 #¹¡¸µ¯§ node-2 #¹¡¸µ¯§ virtual-kubelet-1 #¹¡¸µ¯§ node-3
  2. Environment 28 0 36 . 28 3 4 6 836

    : / (80 : 1.2./ : 62 8 7 : 67.32 :
  3. Operator is õ built-in controller ¶ 43 73 6( 3286300

    6 4/, (3286300 6 / 62 8 7 / 62 8 7 40.( 8 6 40.( 7 8 6 40.( 7 8 ,3 132 8 ) 132 ) 132 (3286300 6 ,3 403 1 28 ) 403 1 28 ) 403 1 28 (3286300 6 ,3 43) 837( 0 6 -36. 328 0 ,3
  4. hƒ 1. e{ ( watch ) resource¶ÉäðÜ(Add/Update/Delete)Çwatch 2. ‚E (

    reconcile ) 1. ÉäðÜU¶ reconcile.Requests ŸÜëÎò 2. ÌâÓÊÏܶSpec(™Äº Y9)±ÒÔÚæ¶Y9Ÿ u§Äži€ 3. u¥³š(–5x´6¦ª‚EÇv› 5x³ÌâÓÊÏÜÇAdd/Update/Delete§Ä— https://kubernetes.io/docs/concepts/overview/components/ .}c~,´&®šªt04SsŸ-w¤Å¯šÄ e{(watch)±‚E(reconcile)Çv›¶ŸController
  5. Operator is õ Operator = Custom Resource + Custom Controller

    https://kubernetes.io/docs/concepts/extend-kubernetes/operator/ • CR ( Custom Resource ) – Deployment¶Á›³ built-in³resource°·³¡–Zt´,r¥ª resource – CRDó Custom Resource Definition ô °,r° Ä • Custom Controller – CRÇe{(watch)–‚E(reconcile)¥“Çyξ´–Zt´-w¥ªcontroller – &Nc³ ÷Deployment controller¶Á›³ built-in³controller± R • watch À reconcile Çv› ¶= Q´ÁĊ^(Operation)Çt§Ä¶ŸOperator
  6. Operator is õ built-in controller ¶ ( @ ) 43

    73 6( 3286300 6 4/, (3286300 6 / 62 8 7 / 62 8 7 40.( 8 6 40.( 7 8 6 40.( 7 8 ,3 132 8 ) 132 ) 132 (3286300 6 ,3 403 1 28 ) 403 1 28 ) 403 1 28 (3286300 6 ,3 43) 837( 0 6 -36. 328 0 ,3 43 7831 73 6( 3286300 6 34 6 836 6 1 36/ 34 6 836 7)/ 7 140 7 1( (- ) 4 6 836 1( (- ) (3286300 6 1 1( (- ) 1 1( (- ) (3286 300 6 ,3 (36 37 4631 8- 7 34 6 836 631 8- 7 0 681 2 , 6 8( 4631 8- 7 34 6 836 ,3 36 (0 1 750 34 6 836 0 78 6 (/ 4 7836 8( 4/, (3286300 67 (0 78 6 (328630 ,3 (/ 4 34 6 836 (3286300 6 ,3 6 7836 34 6 836 (3286300 6 ,3 Operator ¶
  7. -w=T • êÉâêëÇ › – client-go , code-generator ³² •

    built –in ³ÐðÜîòêò·£Å¶êÉâêë°-w¤Å¯šÄ • ´·coreos/prometheus-operator³²¿£¶=T°-w¤Å¯šÄÁ›« • áíòæïòÏÇ › – kubernetes-sigs/kubebuilder – operator-framework/operator-sdk • OLM ( Operator LifeCycle Manager ) • ©¶ – KUDO – Metacontroller
  8. ½k< Operator = Custom Resource + Custom Controller ³¶°– •

    CRD ( Custom Resource Definition ô Ç ½ – spec • reconcile loop°X¤ÅÄ8' – spec±[$¶ÌâÓÊÏܶY9ÇV†¥¯reconcile§Ä – status • reconcile loop°KG¤ÅÄ8' – [$¶ÌâÓÊÏܶY9 ( kubeclt describe °i€° Ä ) • Reconcile ¶\ǁ½ – Spec±[$¶ÒÔÚæ¶Y9¶V† – 5x´6¦¯ÌâÓÊÏܶA (Add/Update/Delete)
  9. operator-framework/getting-started 1. $' " 2. CRD ) 3.  )

    4.  & %( https://github.com/operator-framework/getting-started
  10. 2. CRDLJ CRD¶scaffoldÇq’§Ä https://github.com/operator-framework/getting-started specÇq’ ñ;˜·kubectl create°CR]:J´Ç?, ° Ä ñOperatorŸreconcile

    ¶‘´X§Ä NØéòÜëÈì°·int%¶size(íãëÍD)Ç,r¥¯š ė statusÇq’ ñOperatorŸ[$¶Y9Ç~,§Ä ñ;˜·kubectl describe°i€° Ä NØéòÜëÈì°·string¶±¥¯pod!¶ëÔÜÇ ,r¥¯šÄ—
  11. »±¾ • Operator = Custom Resource + Custom Controller –

    ¶= Q´ÁĊ^(Operation)Çt • Reading – CRD ( Custom Resource Definition ) ǁ½ –reconcile\ǁ½ • Writing – Operator SDK ´ÁÄ-w=”Çn¥»¥ª
  12. »±¾ • Operator = Custom Resource + Custom Controller –

    ¶= Q´ÁĊ^(Operation)Çt • Reading – CRD ( Custom Resource Definition ) ǁ½ –reconcile\ǁ½ • Writing – Operator SDK ´ÁÄ-w=”Çn¥»¥ª OperatorÇ+´\|¥»¥ª