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

DockerとKubernetesでアプリケーション開発にコンテナをフル活用!

stormcat24
November 08, 2018

 DockerとKubernetesでアプリケーション開発にコンテナをフル活用!

11/7開催:DockerとKubernetesでアプリケーション開発にコンテナをフル活用!

http://www.itstaffing.jp/engineer/entry/20181022_2_1

stormcat24

November 08, 2018
Tweet

More Decks by stormcat24

Other Decks in Programming

Transcript

  1. )FBEMJOF ‣ %PDLFSͱ͸ʁίϯςφͱ͸ʁ ‣ %PDLFSΛମݧ͢Δ ‣ %PDLFSϑϨϯυϦͳΠϝʔδΛͭ͘Δ ‣ ίϯςφΦʔέετϨʔγϣϯͱ͸ʁ ‣

    ,VCFSOFUFTͰͷ࣮ફతͳΞϓϦέʔγϣϯ։ൃ ‣ ύϒϦοΫΫϥ΢υͰͷίϯςφӡ༻ ‣ ίϯςφͷӡ༻Λࢧ͑Δπʔϧ
  2. ϩʔΧϧͰͷ%PDLFS؀ڥߏங EPDLFSWFSTJPO $MJFOU 7FSTJPODF "1*WFSTJPO (PWFSTJPOHP (JUDPNNJU⒎B #VJMU8FE+VM 04"SDIEBSXJOBNE &YQFSJNFOUBMGBMTF

    4FSWFS &OHJOF 7FSTJPODF "1*WFSTJPO NJOJNVNWFSTJPO  (PWFSTJPOHP (JUDPNNJU⒎B #VJMU8FE+VM 04"SDIMJOVYBNE
  3. ઃఆΛίϯςφʹ౉͢ํ๏ ‣ ࣮ߦ࣌ͷҾ਺ ‣ ઃఆ͕ଟ͍৔߹ɺऔΓճ͠ʹ͍͘ ‣ ΞϓϦέʔγϣϯͷ؀ڥผઃఆϑΝΠϧ ‣ EFWFMPQ TUBHJOH

    QSPEVDUJPOผͷઃఆϑΝΠϧΛؚΊΔ ‣ ؀ڥ͕૿͑Δ৔߹ɺΞϓϦέʔγϣϯʴΠϝʔδͷϏϧυ͕ඞཁ ‣ ؀ڥม਺ ‣ ࠷΋Ԧಓͷख๏
  4. %FQMPZNFOU /BNFTQBDF 4FSWJDF *OHSFTT $POGJH.BQ %BFNPO4FU 4UBUFGVM4FU +PC 1PE 3FQMJDB4FU

    +PC $SPO+PC ,VCFSOFUFTͷϦιʔεͨͪ ࠓ೔͸͜ͷͭΛ঺հ͠·͢
  5. 1PE

  6. 1PE

  7. 1PEΛσϓϩΠ͢Δ Demo-3 apiVersion: v1 kind: Pod metadata: name: simple-echo spec:

    containers: - name: nginx image: gihyodocker/nginx-proxy:latest env: - name: BACKEND_HOST value: localhost:8080 ports: - containerPort: 80 - name: echo image: gihyodocker/echo:latest ports: - containerPort: 8080 /HJOYͱFDIPΞϓϦέʔγϣϯͰߏ੒͞ΕΔ1PEΛσϓϩΠ͢Δ
  8. %FQMPZNFOUͷ࡞੒ Demo-4 apiVersion: apps/v1 kind: Deployment metadata: name: echo labels:

    app: echo spec: replicas: 3 selector: matchLabels: app: echo template: metadata: labels: app: echo spec: containers: - name: nginx image: gihyodocker/nginx:latest env: - name: BACKEND_HOST value: localhost:8080 ports: - containerPort: 80 - name: echo image: gihyodocker/echo:latest ports: - containerPort: 8080 ˡUFNQMBUFҎԼ͸ɺઌఔͷ1PEఆٛͱಉ͡
  9. 4FSWJDFͷϚχϑΣετ Demo-5 apiVersion: v1 kind: Service metadata: name: echo spec:

    selector: app: echo release: summer ports: - name: http port: 80 ˡTFMFDUPSͰఆٛͨ͠ϥϕϧʹ Ϛον͢Δ1PEʹτϥϑΟοΫΛྲྀ͢
  10. *OHSFTTͷϚχϑΣετ Demo-6 apiVersion: extensions/v1beta1 kind: Ingress metadata: name: echo spec:

    rules: - host: echo.gihyo.local http: paths: - path: / backend: serviceName: echo servicePort: 80 ˡެ։͢Δ4FSWJDF ˡެ։͢ΔυϝΠϯ ʢ7JSUVBM)PTUʣ
  11. ୅දతͳϚωʔδυαʔϏε ‣ (PPHMF,VCFSOFUFT&OHJOF (,&  ‣ "NB[PO&MBTUJD$POUBJOFS4FSWJDFGPS,VCFSOFUFT &,4  ‣

    ౦ژϦʔδϣϯ͸·ͩະରԠ ‣ LTͰ͸ͳ͍ίϯςφϚωʔδυαʔϏε &$4 ΋͋Δ ‣ "[VSF,VCFSOFUFT4FSWJDF ",4
  12. ϚωʔδυαʔϏεͷྑ͍ͱ͜Ζ ‣ ,VCFSOFUFTΫϥελߏங͕ࣗಈ ‣ Ϛελʔϊʔυͷ؅ཧ͕ෆཁ ‣ ΫϥελͷόʔδϣϯΞοϓ΋͓·͔ͤ ‣ ϓϥοτϑΥʔϜผͷαʔϏεͱɺ਌࿨ੑͷߴ͍࿈ܞ͕Ͱ͖Δ ‣

    *OHSFTT΍ϩʔυόϥϯαʔͱͷ࿈ܞ౳ɹ ‣ "VUPTDBMJOHͰͷϊʔυ૿ݮʹ΋΋ͪΖΜରԠ ‣ ϩάͷӾཡ΍ϞχλϦϯάʹରԠ ‣ ։ൃऀʹͱͬͯຊ࣭తͰͳ͍࡞ۀ͸Ϛωʔδυ͕୅ߦ
  13. &MBTUJDTFBSDI ,JCBOB ‣ &MBTUJDTFBSDI ‣ શจݕࡧΤϯδϯ ‣ ίϯςφͷϩάΛอଘ͢ΔͨΊʹར༻ ‣ ,JCBOB

    ‣ ϩάσʔλՄࢹԽπʔϧ ‣ &MBTUJDTFBSDIʹอ࣋͞ΕͨϩάσʔλΛӾཡͰ͖Δ