Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Speaker Deck
PRO
Sign in
Sign up for free
コンテナオーケストレーションにとどまらないKubernetesの魅力 / osc19tk_yukirii_k8s
yukirii
November 24, 2019
Technology
3
710
コンテナオーケストレーションにとどまらないKubernetesの魅力 / osc19tk_yukirii_k8s
https://www.ospn.jp/osc2019-fall/modules/eguide/event.php?eid=62
yukirii
November 24, 2019
Tweet
Share
More Decks by yukirii
See All by yukirii
Operator でどう変わる? これからのデータベース運用 / cndt2019_k8s_operator
yukirii
12
5.3k
Other Decks in Technology
See All in Technology
Akiba-dot-SaaS-ExtraHop
sakaitakeshi
1
100
データエンジニアを助けてくれるFivetranとSnowflakeの仕様&機能のご紹介
sagara
0
420
DNS権威サーバのクラウドサービス向けに行われた攻撃および対策 / DNS Pseudo-Random Subdomain Attack and mitigations
kazeburo
4
850
証明書って何だっけ? 〜AWSの中間CA移行に備える〜
minorun365
3
2k
Cloudflare Workersで動くOG画像生成器
aiji42
1
450
チケットNFTの仕組み
sbtechnight
0
330
Amazon Forecast を使って売上予測をしてみた
tomuro
0
290
マイクロサービス宣言から8年 振り返りとこれから / Eight Years After the Microservices Declaration A Look Back and A Look Ahead
eisuke
2
130
20230123_FinJAWS
takuyay0ne
0
100
JAWS-UG AI/ML #15 - SageMaker Experimentsで始める機械学習モデルの実験管理
masatakashiwagi
0
550
propsのバケツリレー対策でGlobal_Stateを使うその前に
taro28
8
1.7k
GitHub Codespaces が拡げる開発環境、いつでもどこでも Visual Studio Code で!
dzeyelid
0
150
Featured
See All Featured
Designing Dashboards & Data Visualisations in Web Apps
destraynor
224
50k
Side Projects
sachag
451
37k
Agile that works and the tools we love
rasmusluckow
320
20k
Happy Clients
brianwarren
90
5.8k
Learning to Love Humans: Emotional Interface Design
aarron
263
38k
Facilitating Awesome Meetings
lara
33
4.6k
Navigating Team Friction
lara
176
12k
Three Pipe Problems
jasonvnalue
89
8.9k
Designing Experiences People Love
moore
130
22k
Why You Should Never Use an ORM
jnunemaker
PRO
49
7.9k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
109
16k
Become a Pro
speakerdeck
PRO
6
3.2k
Transcript
ίϯςφΦʔέετϨʔγϣϯʹ ͱͲ·Βͳ͍ ,VCFSOFUFTͷັྗ גࣜձࣾαΠόʔΤʔδΣϯτ ٕज़ຊ෦αʔϏεϦϥΠΞϏϦςΟάϧʔϓ ۅҪ༞थ 0QFO4PVSDF$POGFSFODF5PLZP'BMM!໌େֶ
"CPVUNF 2 ,*3**:VLJ *OGSBTUSVDUVSF&OHJOFFS גࣜձࣾαΠόʔΤʔδΣϯτ ٕज़ຊ෦αʔϏεϦϥΠΞϏϦςΟάϧʔϓ $FSUJpFE,VCFSOFUFT"ENJOJTUSBUPS ZVLJSJJ
[email protected]
,VCFSOFUFTͷಛͱಈ࡞Λ͓͞Β͍ w %FDMBSBUJWF"1* w 3FDPODJMJBUJPO-PPQ w $VTUPN3FTPVSDF$VTUPN$POUSPMMFS ,VCFSOFUFTͷಛΛ׆༻͢Δ
w ,VCFSOFUFT0QFSBUPS w $MVTUFS"1* ·ͱΊ 3
,VCFSOFUFTͷಛͱಈ࡞ ͓͞Β͍ ಛ%FDMBSBUJWF એݴతͳ "1*ͱઃఆ w ϢʔβγεςϜͷl·͍͠ঢ়ଶz EFTJSFETUBUF Λఆٛ w
"1*Λհͯ͠ΫϥελʹొˠϦιʔεΦϒδΣΫτ͕࡞͞ΕΔ Service apiVersion: v1 kind: Service metadata: name: my-service spec: type: LoadBalancer ports: - protocol: TCP port: 80 targetPort: 8080 selector: app: my-app my-service.yaml ྫ4FSWJDF UZQF-PBE#BMBODFS Ϣʔβެ։͢ΔΞϓϦέʔγϣϯϓϩτίϧϙʔτ൪߸Λࢦఆ create/modify object Kubernetes API kubectl apply Cloud
,VCFSOFUFTͷಛͱಈ࡞ ͓͞Β͍ ಛίϯτϩʔϥʹΑΔ3FDPODJMJBUJPO-PPQ ௐϧʔϓ w ,VCFSOFUFTΫϥελ༷ʑͳίϯτϩʔϥͷΈ߹ΘͤͰಈ͍͍ͯΔ w ֤ίϯτϩʔϥࣗͷ୲͢ΔϦιʔεΦϒδΣΫτΛಡΈऔΓ ఆٛ͞Εͨཁ݅Λຬͨ͢Α͏ʹϦιʔεͷ࣮ମ
BDUSVBMTUBUF Λૢ࡞ Service LB Service Controller watch create/modify 0CTFSWF %J⒎ "DU Cloud ΦϒδΣΫτͷ ߋ৽Λݕ ΦϒδΣΫτͷ༰ͱ ࣮ࡍͷϦιʔεͷঢ়ଶΛ ൺֱ ͕ࠩ͋Δ߹ ࣮ࡍͷϦιʔεΛ मਖ਼͢Δ
,VCFSOFUFTͷಛͱಈ࡞ ͓͞Β͍ ಛϢʔβಠࣗͷϦιʔείϯτϩʔϥΛ࣮Ͱ͖Δ w $VTUPN3FTPVSDF w ϢʔβʹΑͬͯಠࣗʹఆٛ͞ΕͨϦιʔε w $VTUPN3FTPVSDF%FpOJUJPOT $3%T
ʹΑͬͯLT"1*Λ֦ு͢Δͱѻ͑Δ w $VTUPN$POUSPMMFS w ϢʔβʹΑͬͯಠࣗʹ࣮͞Εͨίϯτϩʔϥ $VTUPN3FTPVSDF %FpOJUJPO %BUBCBTF$MVTUFS $POUSPMMFS $VTUPN$POUSPMMFS %BUBCBTF$MVTUFS $VTUPN3FTPVSDF kind: DatabaseCluster kind: CustomResourceDefinition spec: names: kind: DatabaseCluster Kubernetes API watch Reconcile Loop
,VCFSOFUFTͷಛΛ׆༻͢Δ ಛ%FDMBSBUJWF"1*ͱઃఆ ಛίϯτϩʔϥʹΑΔ3FDPODJMJBUJPO-PPQ ಛಠࣗͷϦιʔείϯτϩʔϥΛ࣮Ͱ͖Δ ,VCFSOFUFT0QFSBUPS ΞϓϦέʔγϣϯΫϥυϦιʔεΛࣗཧ $MVTUFS"1* ,TΫϥελͰ,TΫϥελΛ࡞ͬͯཧ͢Δ ୯ʹίϯςφΛσϓϩΠ͢Δ͚ͩͰͳ͘ ͜ΕΒͷಛΛ׆͔ͨ͠։ൃɾӡ༻Λ͢Δʹʜ
,VCFSOFUFT0QFSBUPS 8 ಛఆͷΞϓϦέʔγϣϯΛ,VCFSOFUFT্Ͱ࣮ߦɾཧ͢ΔͨΊͷ ιϑτΣΞ ίϯτϩʔϥ w த$3%ͱΧελϜίϯτϩʔϥ w ΞϓϦέʔγϣϯͷӡ༻্ͷφϨοδΛίϯτϩʔϥͱ࣮ͯ͠
w ίϯτϩʔϥࣗମίϯςφԽ͞ΕͨΞϓϦͱͯ͠,VCFSOFUFT্Ͱಈ࡞͢Δ %BUBCBTF$MVTUFS $POUSPMMFS $VTUPN$POUSPMMFS %BUBCBTF$MVTUFS $VTUPN3FTPVSDF watch Reconcile Loop %BUBCBTF$MVTUFS
,VCFSOFUFT0QFSBUPS 9 ಛఆͷΞϓϦέʔγϣϯΛ,VCFSOFUFT্Ͱ࣮ߦɾཧ͢ΔͨΊͷ ιϑτΣΞ ίϯτϩʔϥ w த$3%ͱΧελϜίϯτϩʔϥ w ΞϓϦέʔγϣϯͷӡ༻্ͷφϨοδΛίϯτϩʔϥͱ࣮ͯ͠
w ίϯτϩʔϥࣗମίϯςφԽ͞ΕͨΞϓϦͱͯ͠,VCFSOFUFT্Ͱಈ࡞͢Δ %BUBCBTF$MVTUFS $POUSPMMFS $VTUPN$POUSPMMFS %BUBCBTF$MVTUFS $VTUPN3FTPVSDF watch Reconcile Loop %BUBCBTF$MVTUFS ྫσʔλϕʔεγεςϜ ϊʔυΛͭʹઃఆ
,VCFSOFUFT0QFSBUPS 10 ಛఆͷΞϓϦέʔγϣϯΛ,VCFSOFUFT্Ͱ࣮ߦɾཧ͢ΔͨΊͷ ιϑτΣΞ ίϯτϩʔϥ w த$3%ͱΧελϜίϯτϩʔϥ w ΞϓϦέʔγϣϯͷӡ༻্ͷφϨοδΛίϯτϩʔϥͱ࣮ͯ͠
w ίϯτϩʔϥࣗମίϯςφԽ͞ΕͨΞϓϦͱͯ͠,VCFSOFUFT্Ͱಈ࡞͢Δ %BUBCBTF$MVTUFS $POUSPMMFS $VTUPN$POUSPMMFS %BUBCBTF$MVTUFS $VTUPN3FTPVSDF watch Reconcile Loop %BUBCBTF$MVTUFS ରԠ͢Δίϯτϩʔϥ͕ ઃఆΛͱʹ1PEΛσϓϩΠ
,VCFSOFUFT0QFSBUPS 11 0QFSBUPSͰͲΜͳ͜ͱ͕Ͱ͖Δʁ ྫσʔλϕʔε w Ϋϥελͷ࡞আ w Ϋϥελͷεέʔϧ w োͷݕͱ෮چ
w όοΫΞοϓϦετΞͷࣗಈԽ ྫΫϥυ w Ϋϥυ্ͷϦιʔεͷཧ w Ϛωʔδυ%# w ΦϒδΣΫτετϨʔδͷόέοτ w ͳͲʜ
,VCFSOFUFT0QFSBUPS 12 0QFSBUPSΛ͕͢͞ʹʁ BXFTPNFPQFSBUPST ެ։͞Ε͍ͯΔ0QFSBUPSΛΞϓϦέʔ γϣϯ͝ͱʹूͨ͠υΩϡϝϯτ 0QFSBUPS)VCJP 0QFSBUPSΛΞϓϦέʔγϣϯ։ൃ ϑΣʔζผʹ·ͱΊͨαΠτ
,VCFSOFUFT0QFSBUPS 13 IUUQTTQFBLFSEFDLDPNZVLJSJJDOEULTPQFSBUPS 0QFSBUPSʹؔ͢ΔΑΓৄ͍͠ղઆʜ
$MVTUFS"1* w ,VCFSOFUFTͷαϒϓϩδΣΫτ w $MVTUFS-JGFDZDMF4*(ͷͱ։ൃ͕ਐΊΒΕ͍ͯΔ w ΫϥελͷϥΠϑαΠΫϧʹؔΘΔૢ࡞Λ,Tͷએݴతͳ"1*Ͱఏڙ͢Δ w Ϋϥελͷʮ࡞ɾεέʔϧɾΞοϓάϨʔυɾআʯ w
֤छΫϥυΦϯϓϨϛεͳͲͷڥͰར༻Մೳ 5IF$MVTUFS"1*#PPL IUUQTDMVTUFSBQJTJHTLTJP
,VCFSOFUFTΫϥελͷߏஙɾӡ༻େมʂ Πϯϑϥߏங 44-ূ໌ॻͷཧ ωοτϫʔΫ 7. ετϨʔδ ߋ৽ ൃߦ ϊʔυஔ ιϑτΣΞͷཧ
ύοέʔδͷΠϯετʔϧ ΫϥελΞυΦϯͷಋೖ LTͷόʔδϣϯΞοϓ $MVTUFS"1*͕ొͨ͠എܠ
ΫϥελϚωδϝϯτ༻ͷ༷ʑͳπʔϧ͕ొ w LVCFTQSBZ,VCFSOFUFTΛΠϯετʔϧ͢Δ"OTJCMF1MBZCPPL w LPQT"84ڥʹ,VCFSOFUFTΫϥελΛߏஙɾཧ͢Δπʔϧ w LVCFBENΫϥελίϯϙʔωϯτͷϒʔτετϥοϓʹಛԽͨ͠πʔϧ ͳͲʜɹ πʔϧʹΑͬͯ࡞ۀϥΫʹͳͬͨʂ͕ɺ ͜ͷΑ͏ʹͰ͖Δͱ͏Ε͍͠
w ڥπʔϧʹґଘ͠ͳ͍ڞ௨ͷΫϥελཧํ๏͕΄͍͠ wରԠڥΛՃ͢ΔͨΊͷ࣮؆୯ʹ࣮Ͱ͖Δͱ͏Ε͍͠ w ΫϥελͷϊʔυͷεέʔϧΞοϓσʔτΛࣗಈԽ͍ͨ͠ w ͜ΕΒͷૢ࡞Λએݴతͳ"1*ઃఆͰ࣮ݱ͍ͨ͠ Ͳ͏ͬͯղܾ͢Δʁʁ $MVTUFS"1*͕ొͨ͠എܠ
$MVTUFS"1*͕ొͨ͠എܠ ,VCFSOFUFT͕͢Ͱʹ͍࣋ͬͯΔΞΠσΟΞΛ͏ ࠶ͼ4FSWJDFͷྫ w ઃఆ :".-ϚχϑΣετ ͷ༰ڥඇґଘ˞ w ֤Ϋϥυ͚ͷίϯτϩʔϥ͕ڥʹ߹Θͤͯ-#Λઃఆ Service
Service apiVersion: v1 kind: Service metadata: name: my-service spec: type: LoadBalancer ports: - protocol: TCP port: 80 targetPort: 8080 selector: app: my-app my-service.yaml apply apply GCLB LBaaS cloud-provider gcp cloud-provider openstack watch create watch create ˞ઃఆ༰ʹΑͬͯҟͳΔڥͰ༻Ͱ͖ͳ͍ͷ͋Γ·͢ ྫBOOPUBUJPOΛͬͨΫϥυڥݻ༗ͷઃఆͳͲ
1SPWJEFS*NQMFNFOUBUJPOT ڥݻ༗ͷॲཧ$MVTUFS"1*1SPWJEFSͱͯ͠ຊମ͔ΒΓग़͞Ε͍ͯΔ ֤छΠϯϑϥڥ#PPUTUSBQํ͚ࣜʹϓϩόΠμ͕։ൃ͞Ε͍ͯΔ https://cluster-api.sigs.k8s.io/reference/providers.html *OGSBTUSVDUVSF1SPWJEFS Ϋϥυڥʹ7.-#ͳͲͷ ඞཁͳϦιʔεΛ࡞ w "84 w
"[VSF w #BSF.FUBM w ($1 w 0QFO4UBDL w W4QIFSF w FUDʜ #PPUTUSBQ1SPWJEFS 7.ʹ,TͷίϯϙʔωϯτΛ Πϯετʔϧ͢ΔεΫϦϓτΛੜ w LVCFBEN w 5BMPT
$MVTUFS"1*ʹΑΔΫϥελߏஙɾཧ ৽͍͠ΫϥελΛͭ͘Δʹ ˠΫϥελ $MVTUFS ͱϊʔυ .BDIJOF ͷ:".-Λ༻ҙ͢Δ apiVersion: cluster.x-k8s.io/v1alpha2
kind: Cluster metadata: name: my-cluster spec: clusterNetwork: pods: cidrBlocks: [“192.168.0.0/16”] infrastructureRef: # লུ # Ϋϥυڥݻ༗ͷઃఆͷࢀর cluster.yaml apiVersion: cluster.x-k8s.io/v1alpha2 kind: MachineDeployment metadata: name: my-first-cluster-node01 spec: replicas: 3 template: spec: version: v1.15.3 bootstrap: # লུ # k8sίϯϙʔωϯτͷbootstrapͷ # ํ๏Λఆٛͨ͠ઃఆͷࢀর infrastructureRef: # Ϋϥυڥݻ༗ͷઃఆͷࢀর machine.yaml
$MVTUFS"1*ʹΑΔΫϥελߏஙɾཧ Cloud Environment Management Cluster Cluster Infrastructure Cluster Machine Infrastructure
Machine Bootstrap Config Cluster API Infrastructure Provider CRDs Controller Bootstrap Provider Workload Cluster kind: Cluster kind: Machine CRDs Controller CRDs Controller
$MVTUFS"1*ʹΑΔΫϥελߏஙɾཧ Cloud Environment Management Cluster Cluster Infrastructure Cluster Machine Infrastructure
Machine Bootstrap Config Cluster API Infrastructure Provider CRDs Controller Bootstrap Provider Workload Cluster kind: Cluster kind: Machine CRDs Controller CRDs Controller ଞͷΫϥελΛཧ͢ΔΫϥελ $MVTUFS"1*ͷίϯϙʔωϯτ͕ Πϯετʔϧ͞Ε͍ͯΔ
$MVTUFS"1*ʹΑΔΫϥελߏஙɾཧ Cloud Environment Management Cluster Cluster Infrastructure Cluster Machine Infrastructure
Machine Bootstrap Config Cluster API Infrastructure Provider CRDs Controller Bootstrap Provider Workload Cluster kind: Cluster kind: Machine CRDs Controller CRDs Controller ϥΠϑϥΠΫϧΛཧ͞Ε͍ͯΔΫϥελ ࣮ࡍͷΞϓϦέʔγϣϯΛಈ࡞ͤ͞Δ ϫʔΫϩʔυ༻Ϋϥελͱͯ͠ΘΕΔ
$MVTUFS"1*ʹΑΔΫϥελߏஙɾཧ Cloud Environment Management Cluster Cluster Infrastructure Cluster Machine Infrastructure
Machine Bootstrap Config Cluster API Infrastructure Provider CRDs Controller Bootstrap Provider Workload Cluster kind: Cluster kind: Machine CRDs Controller CRDs Controller $MVTUFSͱ.BDIJOFͷ ΦϒδΣΫτΛ࡞
$MVTUFS"1*ʹΑΔΫϥελߏஙɾཧ Cloud Environment Management Cluster Cluster Infrastructure Cluster Machine Infrastructure
Machine Bootstrap Config Cluster API Infrastructure Provider CRDs Controller Bootstrap Provider Workload Cluster kind: Cluster kind: Machine CRDs Controller CRDs Controller $MVTUFS"1*ίϯτϩʔϥ͕ ΫϥελߏஙʹඞཁͳใΛੜ
$MVTUFS"1*ʹΑΔΫϥελߏஙɾཧ Cloud Environment Management Cluster Cluster Infrastructure Cluster Machine Infrastructure
Machine Bootstrap Config Cluster API Infrastructure Provider CRDs Controller Bootstrap Provider Workload Cluster kind: Cluster kind: Machine CRDs Controller CRDs Controller Ϋϥυڥʹ7.͕࡞͞Ε Ϋϥελ্ཱ͕͕ͪΔ
<ٕज़ॻయ>͡ΊΔ$MVTUFS"1* 26 IUUQTUFDIJFNFEJBCPPUIQNJUFNT lΫϥελͰΫϥελΛ࡞Γཧ͢ΔzΛ ମݧ͢ΔͨΊͷղઆॻ ʲ༰ʳ $MVTUFS"1*ͷഎܠͱ֓ཁ "84ڥʹΫϥελΛͭ͘Δ
ϋϯζΦϯ ,VCFSOFUFTͷΤίγεςϜͱ Έ߹Θ͔ͤͯͭ͏ #005)ʹͯిࢠॻ੶൛ൢചதʂ ຊͷ04$ϒʔε ʹͯ ൦͍ͯ͠·͢ʂ
·ͱΊ w ,VCFSOFUFTએݴతͳ"1* ίϯτϩʔϥͰߏ͞ΕΔ w lίϯςφͷσϓϩΠz͚ͩʹͱͲ·Βͣ ,VCFSOFUFTͷΈ͞·͟·ͳతʹԠ༻Ͱ͖Δ w ,VCFSOFUFT0QFSBUPS ΞϓϦέʔγϣϯݻ༗ͷӡ༻ૢ࡞Λ,VCFSOFUFTʹͤΔ
w $MVTUFS"1* LTΫϥελͰLTΫϥελΛͭ͘Δ એݴతͳ"1*Ͱ͞·͟·ͳΫϥυڥΫϥελΛσϓϩΠ ʮϓϥοτϑΥʔϜΛͭ͘ΔͨΊͷϓϥοτϑΥʔϜʯ ͱͯ͠,VCFSOFUFTΛ׆༻͍ͯ͜͠͏ʂ