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

コンテナの仕組みとエコシステム - Haconiwaを通じて眺めてみる /container-...

KONDO Uchio
October 23, 2017

コンテナの仕組みとエコシステム - Haconiwaを通じて眺めてみる /container-ecosystem-and-haconiwa

@日本OSS推進フォーラム主催 第9回アプリケーション部会勉強会
https://connpass.com/event/68096/

KONDO Uchio

October 23, 2017
Tweet

More Decks by KONDO Uchio

Other Decks in Technology

Transcript

  1. ίϯςφͷઃఆͷಈత੍ޚ wίϯςφͷߏ੒ཁૉ͸ͦ΋ͦ΋ಈతʹ૊Έ߹Θ͕ͤՄೳͰ͋Δɻ
 ʢߏ੒ཁૉ͸ޙड़ʣͳͷͰɺίʔυͰܾఆͰ͖ΔͱศརͰ͋Δɻ Haconiwa.define do |c| #... client = Redis.new

    "127.0.0.1", 6379, 2 data = JSON.parse(client.get(ENV[‘CONTAINER_ID’])) c.cgroup :v1 do |cg| cg[‘cpu.cfs_period_us’] = data[‘period’] cg[‘cpu.cfs_quota_us’] = data[‘quota’] end end ྫ͑͹ɺىಈ࣌ʹ3FEJT͔Β ίϯςφͷ৘ใΛͱ͖ͬͯͯ ಈతʹ$16ׂ౰ͷઃఆ͕Մೳ
  2. ϑοΫͷ࣮ݱܗࣜ w%PDLFS ଞ0$*΂ʔεͷ΋ͷ ͸ϥΠϑαΠΫϧ"1*ͷ؂ࢹͱ͍͏ܗͰ ࣮ݱ͢Δܗʹͳ͍ͬͯΔɻผ్؂ࢹˠϑοΫͷ࣮૷͕ඞཁɻ w-9$͸ઃఆʹϥΠϑαΠΫϧϑοΫ͕͋Δ  wˠίϚϯυܗࣜͰɺҾ਺ͷࢦఆ w)BDPOJXB͸"1* %4-ͷ࢓༷

    ࣗମʹ֤छϑοΫ͕࣮૷͞Ε͓ͯΓɺ 3VCZͰ֤ॲཧΛهड़Մೳɻઃఆ΋ϑοΫ΋ಉ͡ݴޠͰɻ IUUQTMJOVYDPOUBJOFSTPSHKBMYDNBOQBHFTNBOMYDDPOUBJOFSDPOGIUNMMC#$
  3. ·ͱΊɿද هड़ݴޠ ίϯςφઃఆ "1* ϑοΫ࣮૷ ϑοΫͷछྨ Πϝʔδઓུ %PDLFS SVOD (PMBOH

    %PDLFSpMF ίϚϯυϥΠϯ )551"1* ϥΠϑαΠΫϧ
 ؂ࢹ ϥΠϑλΠϜ %PDLFSIVC
 0$*४ڌ -9$ $ JOJpMF MJCMYD ϑοΫઃఆ߲໨ ϥΠϑλΠϜ MYDUFNQMBUF -9% (PMBOH 1SPpMF )551"1*    3BJM$BS 3VTU 0$*४ڌ
 KTPO 0$*४ڌ KTPO ະαϙʔτ  0$*४ڌ  NJDSPDPOUBJOFST )BDPOJXB NSVCZ $ 3VCZ%4- 3VCZ%4- 3VCZ%4- ϥΠϑλΠϜ 
 λΠϜΞ΢τଞछ MYDUFNQMBUF
 ྲྀ༻ଞ
  4. ྫωοτϫʔΫ໊લۭؒ FUI EPDLFS WFUIIPTU WFUIHVFTU WFUIIPTU WFUIHVFTU WFUIIPTU WFUIHVFTU FH

    FH    ඞཁʹԠ͡/"5ͳͲ /FUXPSL/BNFTQBDFʹΑΓɺ ίϯςφϓϩηε͕ϗετͱ͸ผͷ/*$*1ΛೝࣝͰ͖Δ ͻͱͭͷ)PTU CSJEHF
  5. ૚ಉ࢜ͷ࢓༷ͷఆٛͷҰྫ w,VCFSOFUFTͷ$3*ͷྫ wEach container runtime has it own strengths wKubelet

    communicates with the container runtime... over Unix sockets using the gRPC framework w$3*ʹԊ࣮ͬͯ૷͢Ε͹ɺྫ͑͹,VCFSOFUFTͷ্Ͱ)BDPOJXBΛಈ͔ ͢͜ͱ΋Ͱ͖ΔͰ͋Ζ͏ɻ IUUQCMPHLVCFSOFUFTJPDPOUBJOFSSVOUJNFJOUFSGBDFDSJJOLVCFSOFUFTIUNM
  6. ͷ͏ͪɺʮϥϯλΠϜʯͷօ͞Μ EPDLFS SVOD DSJP MYD MYE SBJMDBS IBDPOJXB LVCFSOFUFT OPNBE

    VOTIBSF SLU TXBSN (,& .BHOVN DISPPU &$4 "$* SLUMFU SBODIFS NPCZ
  7. վΊͯEPDLFSEͷϓϩηεπϦʔͷྫ /usr/bin/dockerd --debug -l debug -H fd:// --... \_ docker-containerd

    -l unix:///var/run/docker/... \_ docker-containerd-shim 95b86b... docker-runc \_ /bin/bash
  8. /usr/bin/dockerd --debug -l debug -H fd:// --... \_ docker-containerd -l

    unix:///var/run/docker/... \_ docker-containerd-shim 95b86b... docker-runc \_ /bin/bash େ·͔ͳ໾ׂ෼୲ EPDLFSEIUUQϦΫΤετΛड͚औΔ
  9. /usr/bin/dockerd --debug -l debug -H fd:// --... \_ docker-containerd -l

    unix:///var/run/docker/... \_ docker-containerd-shim 95b86b... docker-runc \_ /bin/bash େ·͔ͳ໾ׂ෼୲ EPDLFSEIUUQϦΫΤετΛड͚औΔ DPOUBJOFSEEPDLFSE͔ΒͷϦΫΤετΛड͚औΓ
 ίϯςφ؀ڥΛηοτΞοϓͯ͠DPOUBJOFSETIJNʹ౉͢
  10. /usr/bin/dockerd --debug -l debug -H fd:// --... \_ docker-containerd -l

    unix:///var/run/docker/... \_ docker-containerd-shim 95b86b... docker-runc \_ /bin/bash େ·͔ͳ໾ׂ෼୲ EPDLFSEIUUQϦΫΤετΛड͚औΔ DPOUBJOFSEEPDLFSE͔ΒͷϦΫΤετΛड͚औΓ
 ίϯςφ؀ڥΛηοτΞοϓͯ͠DPOUBJOFSETIJNʹ౉͢ DPOUBJOFSETIJNܾ·ͬͨϓϩτίϧͰSVODଞϥϯλΠϜΛىಈ͢Δ
  11. /usr/bin/dockerd --debug -l debug -H fd:// --... \_ docker-containerd -l

    unix:///var/run/docker/... \_ docker-containerd-shim 95b86b... docker-runc \_ /bin/bash େ·͔ͳ໾ׂ෼୲ EPDLFSEIUUQϦΫΤετΛड͚औΔ DPOUBJOFSEEPDLFSE͔ΒͷϦΫΤετΛड͚औΓ
 ίϯςφ؀ڥΛηοτΞοϓͯ͠DPOUBJOFSETIJNʹ౉͢ DPOUBJOFSETIJNܾ·ͬͨϓϩτίϧͰSVODଞϥϯλΠϜΛىಈ͢Δ ίϯςφԽͨ͠ϓϩηεࣗମ
  12. ͜͏͍͏࣮૷Λ౿·͑ͯ෼͚ͯΈͨ %PDLFS"1*ɺ$3*ͳͲΛ ड͚औͬͯίϯςφͷͨΊͷ४උͱ ىಈϓϩηεΛ୲౰͢Δ EPDLFSE DPOUBJOFSE NPCZ DPOUBJOFSE DSJP SLUMFU

    SVOD SLU SBJMDBS  MYE MYD IBDPOJXB ࣮ࡍʹɺΧʔωϧͷ γεςϜίʔϧΛݺͿͳͲͯ͠ ίϯςφϓϩηεΛ࡞੒͢Δ
  13. ͜͏͍͏࣮૷Λ౿·͑ͯ෼͚ͯΈͨ %PDLFS"1*ɺ$3*ͳͲΛ ड͚औͬͯίϯςφͷͨΊͷ४උͱ ىಈϓϩηεΛ୲౰͢Δ $PNNVOJDBUPS Ծ -PDBUFS Ծ EPDLFSE DPOUBJOFSE

    NPCZ DPOUBJOFSE DSJP SLUMFU SVOD SLU SBJMDBS  MYE MYD IBDPOJXB ࣮ࡍʹɺΧʔωϧͷ γεςϜίʔϧΛݺͿͳͲͯ͠ ίϯςφϓϩηεΛ࡞੒͢Δ
  14. ͜Ε͔Β Χʔωϧࣗମ Χʔωϧ֦ுͳͲ γεςϜίʔϧ /BNFTQBDF DHSPVQ $BQBCJMJUZ DISPPU౳ TFDDPNQ 

    )PPLT /FUXPSLؔ࿈ઃఆ ΦʔέετϨʔγϣϯ૚ͱͷ࿈ܞ ίʔυԽͰ͖Δ ൣғΛ૿΍͢ ίϯςφϋοΫ
 ͷͨΊͷ ೖΓޱʹ