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

コンテナ技術とコンテナオーケストレーション入門

tarosaiba
December 25, 2018

 コンテナ技術とコンテナオーケストレーション入門

【初心者向けにコンテナ技術を解説します】
1. コンテナとは?
2. コンテナオーケストレーションとは?
3. これからのアプリケーション開発 & デプロイ & 運用 方法

tarosaiba

December 25, 2018
Tweet

More Decks by tarosaiba

Other Decks in Technology

Transcript

  1. @tarosaiba ˔  'VUVSF"SDIJUFDU *OD ˔  5*(ॴଐ೥໨ ˔  *OGSB.8$*पΓ΍͖ͬͯ·ͨ͠ ˔  "84($1

    ˔  *OGSBTUSVDUVSFBT$PEFͷಋೖ͕ಘҙ ʲ໌೔ͷ։ൃΧϯϑΝϨϯεొஃʳ ਆ&YDFMखॱॻϕʔεͷӡ༻͔Β"OTJCMFͰͷࣗಈԽ΁  IUUQXXXBUNBSLJUDPKQBJUBSUJDMFTOFXT@IUNM 4IVOUBSP4BJCB 2
  2. 4 ࢲͷ͍··Ͱ エンプラ⼩売り & AWS エンプラ⾦融 & オンプレ エンプラ⼩売り &

    GCP エンプラ⼩売り & AWS ຊ൪؀ڥͰίϯςφ ӡ༻Λܦݧ
  3. 8

  4. 10 Kubernetes is infrastructure for next generation applications, PaaS and

    more. –Brendan Burns, Partner Architect, at Microsoft and co-founder of Kubernetes 
  5. 11 Kubernetes is infrastructure for next generation applications, PaaS and

    more. –Brendan Burns, Partner Architect, at Microsoft and co-founder of Kubernetes  ࢲݸਓ ΄Μͱʙʹͦ͏ࢥ͏ʂʂ
  6. %PDLFSͰ)FMMPXPSE ˔  ͨͩʮ)FMMP8PSMEʯͱग़ ྗ͢Δ͚ͩ  ˔  %PDLFSެࣜͷνϡʔτϦ Ξϧʹ͋Γ·͢ IUUQTEPDTEPDLFSDPNHFUTUBSUFEUFTUEPDLFS WFSTJPO

     23 # docker run > docker run hello-world # docker run > docker run hello-world Hello from Docker! This message shows that your installation appears to be working correctly.
  7. %PDLFSͰOHJOY 24 # docker run > docker run --name nginx

    -d -p 8080:80 nginx:latest ˔  OHJOYΛಈ͔ͯ͠ΈΑ͏
  8. %PDLFSͰUPNDBU 25 # docker run > docker run --name tomcat

    -d -p 8080:8080 tomcat:latest ˔  UPNDBUΛಈ͔ͯ͠ΈΑ͏
  9. %PDLFSͰ+FOLJOT 26 # docker run > docker run --name jenkins

    -d -p 8080:8080 jenkins:latest ˔  +FOLJOTΛಈ͔ͯ͠ΈΑ͏
  10. ͓·͚  %PDLFSͰ)FMMPXPSE ˔  ͨͩʮ)FMMP8PSMEʯͱग़ ྗ͢Δ͚ͩͰ͸ͳ͘ɺ͜ Μͳ͜ͱ΋Ͱ͖·͢ ˔  DPXTBZͱ͍͏πʔϧΛ࢖ ͍ͬͯ·͢

    27 # docker run > docker run docker/whalesay cowsay Hello.I am Saiba. ___________________ < Hello.I am Saiba. > ------------------- \ \ \ ## . ## ## ## == ## ## ## ## === /""""""""""""""""___/ === ~~~ {~~ ~~~~ ~~~ ~~~~ ~~ ~ / ===- ~~~ \______ o __/ \ \ __/ \____\______/
  11. 37 Infrastructure Host Operating System Hypervisor Guest OS VM Guest

    OS VM ಈ࡞Πϝʔδ Bins/Libs Bins/Libs App A App B Infrastructure Host Operating System Docker Engine Bins/Libs Bins/Libs App A App B Ծ૝Ϛγϯ ίϯςφ
  12.  EPDLFSQVMM 42 ˔  ίϯςφͷΠϝʔδΛμ΢ϯϩʔυ ͠·͢ Docker Deamon Containers Images Repogitory

    # docker pull > docker pull centos:latest latest: Pulling from library/centos a02a4930cb5d: Downloading [========> [..] pull
  13. EPDLFSSVO 43 # docker run > docker run --name nginx

    -d -p 8080:80 nginx:latest ˔  Πϝʔδ͔ΒίϯςφΛ࡞੒͠·͢ Docker Deamon Containers Images Repogitory run
  14. EPDLFSQT 44 # docker ps > docker ps CONTAINER ID

    IMAGE COMMAND CREATED STATUS PORTS NAMES 94641045a2b7 nginx:latest "nginx -g 'daemon off" 9 seconds ago Up 7 seconds 0.0.0.0:8080->80/tcp nginx ˔  ίϯςφͷεςʔλεΛ֬ೝ͠·͢ Docker Deamon Containers Images Repogitory ps
  15. 54

  16. ͘Β΂ͯΈ·͠ΐ͏ 66 Ծ૝ϚγϯWFS EC2 Amazon Linux Tomcat ɹɹApplication _ EC2

    Amazon Linux Tomcat ɹɹApplication Docker _ ίϯςφWFS
  17. 69

  18. 78

  19.  %PDLFSGJMF 80 ˔  %PDLFSJNBHFΛ࡞੒͢ΔͨΊͷઃ ఆϑΝΠϧ ˔  ΞϓϦ͕ґଘ͢Δϛυϧ΢ΣΞ΍04 ͷϥΠϒϥϦΛઃఆɺΞϓϦͦͷ΋ ͷΛ഑ஔ͢Δ ˔ 

    ࠓ·Ͱͷαʔόߏஙͷखॱ͸ɺ͜ͷ ϑΝΠϧʹ୅ΘΔ QLHΠϯετʔ ϧɺઃఆϑΝΠϧฤू౳  # ※͋͘·Ͱ΋αϯϓϧͰ͢ɻ͜ΕͰ͸ಈ͖·ͤΜ※ # ϕʔεͷΠϝʔδΛࢦఆ FROM alpine:3.8 # JavaΛInstall RUN apk add --update openjdk8 # ؀ڥม਺Λઃఆ ENV JAVA_HOME /usr/lib/jvm/java-1.8-openjdk ENV PATH $PATH:/usr/lib/jvm/java-1.8-openjdk/ jre/bin # my-app.jarΛίϯςφʹίϐʔ COPY ./my-app.jar / # ίϯςφ಺Ͱmy-app.jarΛ࣮ߦ CMD [“java”, “-jar”, “./my-app.jar”] EXPOSE 80
  20. EPDLFSCVJME 81 ˔  %PDLFSGJMFͷઃఆʹج͍ͮͯɺ %PDLFSJNBHFΛ࡞੒ Ϗϧυ ͢Δ Docker Deamon Containers

    Images Dockerfile # Dockerfile > ls Dockerfile # docker build > docker build ./ -t example build
  21. 87

  22. ͳʹΛͯ͘͠ΕΔͷ͔ 91 ˔  ίϯςφؒ֎෦ͱͷ/8੍ޚ ˔  σϓϩΠϩʔϧόοΫ ˔  ؂ࢹ ˔  ࣗಈ෮چ

    ˔  εέʔϦϯά ˔  FUD Host Servers ௨৴ ௨৴ ؂ࢹ εέʔϦϯά ΦʔέετϨʔγϣϯ πʔϧ
  23. &$4ͷ؆୯ͳ࢓૊Έ 95 ECS Cluster EC2 EC2 Service Task Task ɾɾɾ

    ˔  &$ͰΫϥελΛߏ੒ ˔  5BTL ίϯςφ Ͱίϯ ςφΠϝʔδΛࢦఆ ˔  4FSWJDFͰ5BTL਺Λࢦఆ
  24. (,&ͷ؆୯ͳ࢓૊Έ 97 GKE Cluster GCE Host GCE Host Deployment Pod

    Pod ɾɾɾ ˔  ($&ͰΫϥελΛߏ੒ ˔  %FQMPZNFOUͰ ίϯςφΠϝʔδͱՔಇ ਺Λઃఆ ˔  1PE ίϯςφ 
  25. ΞϓϦͷ࡞Γ͕มΘΔ 109 ˔  ͭͷίϯςφʹ͸ɺͭͷϓϩηε ΞϓϦ ͚ͩΛಈ͔͢  ˔  ͭͷίϯςφΠϝʔδͰɺෳ਺؀ڥʹσϓϩΠͰ͖ΔΑ͏ʹ ΞϓϦͷઃఆ

    %#઀ଓઌ ͸؀ڥม਺Ͱ౉ͤΔΑ͏ʹ͢Δ  ˔  ίϯςφ͸ɺεςʔτϨεʹ͢Δ εςʔτΛ࣋ͭ৘ใ͸%#ͳͲͷαʔϏεͰอ࣋  
  26. ໾ׂ͕มΘΔ 113 ˔  ίϯςφΛ࡞Δ   ˔  ίϯςφΛಈ͔͢  

    ΞϓϦέʔγϣϯ࡞Γ ʹूதͰ͖Δʂ αʔϏεͷ҆ఆӡ༻ ʹूதͰ͖Δʂ
  27. ໾ׂ͕มΘΔ 114 ˔  ίϯςφΛ࡞Δ   ˔  ίϯςφΛಈ͔͢  

    ΞϓϦέʔγϣϯ࡞Γ ʹूதͰ͖Δʂ αʔϏεͷ҆ఆӡ༻ ʹूதͰ͖Δʂ ΋ͪΖΜ࿈ܞ͸ඞਢ
  28. Πϯϑϥߏ੒͕มΘΔ &$4WFS  117 RDS ECS tomcat Cluster ECS httpd

    Cluster ALB ALB ※ ͋͘·Ͱ΋ࢀߟͰɺΠϝʔδఔ౓Ͱ Container (Task)
  29. Πϯϑϥߏ੒͕มΘΔ (,&WFS  118 Cloud SQL GKE Cluster Cloud Load

    Balancing ※ ͋͘·Ͱ΋ࢀߟͰɺΠϝʔδఔ౓Ͱ Service (Kubernetes) Container (Pod)
  30. ؂ࢹ͸ʁ 126 ˔  ؂ࢹͷ؍఺΋ɺ݁ߏมΘΔͱࢥ͍·͢ɻҎԼͷࢀߟΠϝʔδͰ͢ ˔  ίϯςφͱϗετͦΕͧΕͰ؂ࢹ͢Δඞཁ͋Γͳͷ͕ϙΠϯτ   Host Container

    Container APP APP APP APP ORCHESTRATION ˔ ,VCFSOFUFTͷFWFOUϩά ˔ ΞϓϦͷϩά ˔  ίϯςφຖͷ $16.&.౳ͷϝτϦΫε ˔ ίϯςφՔಇ਺ ˔ $16.&.౳ͷϝτϦΫε