Chatops, AWS, And Ansible

D02d368f98011616d6a8612af1ca4de5?s=47 nnao45
December 06, 2018
800

Chatops, AWS, And Ansible

D02d368f98011616d6a8612af1ca4de5?s=128

nnao45

December 06, 2018
Tweet

Transcript

  1. CHATOPS,AWS, AND ANSBLE CyberAgent, inc. @nnao45 with cndjp

  2. ˏnnao45 ✓ 27ࡀ(ฏ੒3೥ੜ·Ε) ✓ ࠓ͸ओʹΫϥ΢υ԰ ✓ ཱڭେֶཧֶ෦ԽֶՊଔۀ ✓ ςχεྺ10೥ ✓

    ITྺ4೥໨ ✓ Go࠷ߴ!!zsh࠷ߴ!! ✓cndjpษڧձӡӦ ✓גࣜձࣾαΠόʔΤʔδΣϯτॴଐ ✓ ݩISPͷNWϝΠϯ $ WHOIS NNAO45
  3. JAPAN CONTAINER DAYS!! ͓ർΕ༷Ͱͨ͠ʢɾ˜ɾʣ

  4. JAPAN CONTAINER DAYS!! ͓ർΕ༷Ͱͨ͠ʢɾ˜ɾʣ https://speakerdeck.com/cndjp/jkd-v18-dot-12-2w3

  5. JAPAN CONTAINER DAYS!! ͓ർΕ༷Ͱͨ͠ʢɾ˜ɾʣ https://speakerdeck.com/cndjp/jkd-v18-dot-12-2w3

  6. SHOW CNDJP INFRASTRUCTURE ଟ͘ͷΠϯϑϥ΁ͷ՝୊ͱཁٻɾɾɾʂ ࣗಈతʹΫϥ΢υ(AWS)Λબ୒ ʮ׬શίʔυ؅ཧx൒ࣗಈCD͕ඞਢʯ ౰વશίϯϙʔωϯτΛίʔυԽ कඋൣғͷ޿͞ͱ׳ΕͯΔͱ͍͏
 ཧ༝ʹΑΓɺAnsibleΛ࠾༻ Զ͡Όͳͯ͘΋σϓϩΠͰ͖ΔΑ͏


    SlackʹΑΔChatOpsͷ࣮૷ ։ൃ࣌ʮͷΈʯશΠϯϑϥΛ୭Ͱ΋σϓϩΠ ·ɺϚωʔ ͕ɾɾɾɾɻ
  7. SHOW CNDJP INFRASTRUCTURE ଟ͘ͷΠϯϑϥ΁ͷ՝୊ͱཁٻɾɾɾʂ એݴతઃఆ͕ՄೳͳK8SΛ࠾༻ શίϯϙʔωϯτΛCloudformation
 AnsibleʹΑΓႈ౳ੑΛ֬อʂ ͞ΒʹύΠϓϥΠϯʹSpinnakerɺ
 όοΫΞοϓπʔϧʹHeptio/ArkΛ
 Λ࢖༻ͯ͠ঢ়ଶΛ҆Ձʹอ࣋Ͱ͖Δ


    ύΠϓϥΠϯΛߏங ࢖͍ऴΘͬͨΒɺʮঢ়ଶΛอ࣋ͯ͠ʯશ෦Լ͛Δ
  8. SHOW CNDJP INFRASTRUCTURE

  9. SHOW CNDJP INFRASTRUCTURE ϩάऩू ؂ࢹ τϨʔγϯά ίϯςφ ϥϯλΠϜ ίϯςφ Φʔέετϥ

    ՄࢹԽ αʔϏε σΟεΧόϦ ߏ੒؅ཧ ΠϯϑϥCD RDS Ωϟογϡ όοΫΞοϓ ϑϩϯτ ίʔυ؅ཧ CICD ύΠϓϥΠϯ ΧφϦΞϦϦʔε+GitOps+CNΛ࣮ݱ͢Δϛυϧ΢ΣΞ
  10. SHOW CNDJP INFRASTRUCTURE deploy!!

  11. SHOW CNDJP INFRASTRUCTURE destroy!!

  12. SHOW CNDJP INFRASTRUCTURE destroy!!

  13. THIS IS “COOL” INFRASTRUCTUREʁ

  14. SO…BUT, AND “TURAMI”ʂ

  15. WHAT IS THE “TURAMI” ίϯςφωΠςΟϒͳίϯςϯπσϦόϦ͕ͭΒΈ Kubernetes্ͰύΠϓϥΠϯΛ
 ׬݁ͤ͞ΔͨΊͷ੍໿͕ਏ͍ɻ ̍γΣϧڬΈ͍ͨͷʹɺ
 ֎෦ύΠϓϥΠϯ͸ʮWebhookʯ
 ͚ͩͩͱɾɾɾɾʂʁ

    VMͰAnsibleΛ༻ҙ͕ͨ͠ɺ
 ૬౰؁͑ͨײ͕͋ΔʢŬŧŒŗ ύΠϓϥΠϯͷΩοΫʹγΣϧ͕ແ͍ɾɾɾʁ
  16. WHAT IS THE “TURAMI” EKSͷAWSϦιʔεͱͷ࿈ಈͱ͔ɾɾɾɻ ϙΠϙΠ্͛Լ͛ͯͯ͠ؾ෇͍ͨΒɺ ELB͕200ݸҐ͋ͬͯ૲΋ੜ͑ͳ͍ ͦͯ͠ඥ͍ͮͯग़དྷͨϦιʔε͸ɺ
 ґଘઌ͕ফ͑ͯͳ͍ͱফ͑ͳ͍ ࢓ํͳ͍͔ΒEKSͰࣗಈͰ࡞Δ


    ϦιʔεΛফ͢࢓૊ΈΛ࡞Δͱ͍͏
 ͳΜ͔͜͏ΞϨͳؾ࣋ͪɻ EKSͷ࿈ಈσϓϩΠ͞ΕͨϦιʔε͕ফ͑ແ͍
  17. WHAT IS THE “TURAMI” AWSωΠςΟϒͳίʔυ؅ཧʹ MySQLͱ͔RedisΛRoute53ͷ໊લ
 ʹඥ͚ͮͯ؅ཧ͠Α͏ͱ͢Δͱɺ
 ΋͏Cloudformationແ͍ͱେมɻ ͦ͏ͯ͠ɺ΄ͱΜͲͷAWSϦιʔε
 ͕CloudformationͰ؅ཧ͢Δࣄʹɻ

    ΠϛϡʔλϒϧͳK8SΛ࠾༻ͨ͠
 ҙຯ͕ബΕ͍ͯ͘ɾɾɾʁ ͲΜͲΜCloudformation͋Γ͖ͳߏ੒ʹɻ
  18. TOO “TURAMI”…

  19. BUT!! I FIND THE “YABAMI” !!

  20. WHAT IS THE “YABAMI” ChatOpsͰʮΦϖϛε࡟ݮʯxʮѪணʯ Python3.7ͷasyncioύοέʔδͰ
 ඇಉظ͔ͭλεΫεέδϡʔϦϯά γϯϓϧͳChatOpsͷbotΛৗற
 ͢Δ͜ͱͰɺΞϓϦ։ൃऀ͕ɺ
 ͍ͭͰ΋؆୯ʹσϓϩΠՄೳ

    BOTΛΩϟϥԽ͢Δ͜ͱͰɺ
 Ѫண͕Θ͖ɺϝϯς͞ΕΔΑ͏ʹʂ ΩοΫͤ͞ΔεΫϦϓτΛPython3Ͱߋʹॊೈʹ
  21. WHAT IS THE “YABAMI” • • • GCPͷVMΠϯελϯεΛৗ্ཱ͓͖࣌ͪ͛ͯɺ ʮ্͛ͯʯͳͲͷૢ࡞Λ࣮ࢪ •

  22. WHAT IS THE “YABAMI” KubernetesͷόοΫΞοϓʹʮHeptio/Arkʯ ͓޷͖ͳΫϥ΢υϕϯμʹ
 etcdʹ֨ೲ͞ΕͨAPIίʔυΛ
 όοΫΞοϓ͓ͯ͘͠ͱ͍͏΋ͷ ඇৗʹߴ଎ͰɺಉϦʔδϣϯͳΒ
 ̎ඵҎ಺ͰόοΫΞοϓ/ϦετΞʂ

    PVͱίϯςφAPI͕ඥ͚ͭͰ͖ͯɺ
 ͜ΕͰΑΓڧྗʹόοΫΞοϓɻ ʮએݴʯͷόοΫΞοϓͱ͍͏Ξϓϩʔν
  23. WHAT IS THE “YABAMI” ΋ͪΖΜΞʔϯγϘʔ΋׆༂ͨͧ͠ʂ Ͳ͏ͯ͠΋ϚΠΫϩαʔϏε࿈ܞ͸
 πʔϧ܈΋ଟ͘ͳΔ͕ɺͦͷ؅ཧʹ
 ႈ౳ੑΛɻ K8SΛ໾ׂඃΔʁ͍΍ɺ໾ׂඃΔ
 ͔ΒίϯςφΦʔέετϨʔγϣϯ


    ʹ૊ΈࠐΈ΍͍͢ʂ γΣϧୟؚ͖ΊখճΓ͕ར͘ͷͰɺ
 ແବͳπʔϧΛ૿΍ͣ͞ʹࡁΉɻ कඋൣғͷ޿͞ɺখճΓͷྑ͞ɺK8Sͱ૬ੑ˕
  24. $SHUTDOWN +10 Ϋϥ΢υωΠςΟϒͳπʔϧ͸ɺ
 ·ͩ·ͩൃల్্ͳ෦෼͕໨ཱͭɻ ͦͷൃల్্ͳ෦෼ΛͦͬͱຒΊͯ͘ΕΔɺ
 ͦΕ͕AnsibleͳΜͩΑͳ͊ɾɾɾɾΈͭ˔ɻ