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

2cf373725ded741824c50fd571eda6e1?s=47 KONDO Uchio
October 23, 2017

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

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

2cf373725ded741824c50fd571eda6e1?s=128

KONDO Uchio

October 23, 2017
Tweet

Transcript

  1. 10.
  2. 17.

    ίϯςφͷઃఆͷಈత੍ޚ 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ׂ౰ͷઃఆ͕Մೳ
  3. 18.
  4. 24.

    ϑοΫͷ࣮ݱܗࣜ w%PDLFS ଞ0$*΂ʔεͷ΋ͷ ͸ϥΠϑαΠΫϧ"1*ͷ؂ࢹͱ͍͏ܗͰ ࣮ݱ͢Δܗʹͳ͍ͬͯΔɻผ్؂ࢹˠϑοΫͷ࣮૷͕ඞཁɻ w-9$͸ઃఆʹϥΠϑαΠΫϧϑοΫ͕͋Δ  wˠίϚϯυܗࣜͰɺҾ਺ͷࢦఆ w)BDPOJXB͸"1* %4-ͷ࢓༷

    ࣗମʹ֤छϑοΫ͕࣮૷͞Ε͓ͯΓɺ 3VCZͰ֤ॲཧΛهड़Մೳɻઃఆ΋ϑοΫ΋ಉ͡ݴޠͰɻ IUUQTMJOVYDPOUBJOFSTPSHKBMYDNBOQBHFTNBOMYDDPOUBJOFSDPOGIUNMMC#$
  5. 27.

    ·ͱΊɿද هड़ݴޠ ίϯςφઃఆ "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
 ྲྀ༻ଞ
  6. 43.

    ྫωοτϫʔΫ໊લۭؒ FUI EPDLFS WFUIIPTU WFUIHVFTU WFUIIPTU WFUIHVFTU WFUIIPTU WFUIHVFTU FH

    FH    ඞཁʹԠ͡/"5ͳͲ /FUXPSL/BNFTQBDFʹΑΓɺ ίϯςφϓϩηε͕ϗετͱ͸ผͷ/*$*1ΛೝࣝͰ͖Δ ͻͱͭͷ)PTU CSJEHF
  7. 76.

    ૚ಉ࢜ͷ࢓༷ͷఆٛͷҰྫ 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
  8. 78.
  9. 79.

    ͷ͏ͪɺʮϥϯλΠϜʯͷօ͞Μ EPDLFS SVOD DSJP MYD MYE SBJMDBS IBDPOJXB LVCFSOFUFT OPNBE

    VOTIBSF SLU TXBSN (,& .BHOVN DISPPU &$4 "$* SLUMFU SBODIFS NPCZ
  10. 81.

    վΊͯEPDLFSEͷϓϩηεπϦʔͷྫ /usr/bin/dockerd --debug -l debug -H fd:// --... \_ docker-containerd

    -l unix:///var/run/docker/... \_ docker-containerd-shim 95b86b... docker-runc \_ /bin/bash
  11. 82.

    /usr/bin/dockerd --debug -l debug -H fd:// --... \_ docker-containerd -l

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

    /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ʹ౉͢
  13. 84.

    /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ଞϥϯλΠϜΛىಈ͢Δ
  14. 85.

    /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ଞϥϯλΠϜΛىಈ͢Δ ίϯςφԽͨ͠ϓϩηεࣗମ
  15. 87.

    ͜͏͍͏࣮૷Λ౿·͑ͯ෼͚ͯΈͨ %PDLFS"1*ɺ$3*ͳͲΛ ड͚औͬͯίϯςφͷͨΊͷ४උͱ ىಈϓϩηεΛ୲౰͢Δ EPDLFSE DPOUBJOFSE NPCZ DPOUBJOFSE DSJP SLUMFU

    SVOD SLU SBJMDBS  MYE MYD IBDPOJXB ࣮ࡍʹɺΧʔωϧͷ γεςϜίʔϧΛݺͿͳͲͯ͠ ίϯςφϓϩηεΛ࡞੒͢Δ
  16. 88.

    ͜͏͍͏࣮૷Λ౿·͑ͯ෼͚ͯΈͨ %PDLFS"1*ɺ$3*ͳͲΛ ड͚औͬͯίϯςφͷͨΊͷ४උͱ ىಈϓϩηεΛ୲౰͢Δ $PNNVOJDBUPS Ծ -PDBUFS Ծ EPDLFSE DPOUBJOFSE

    NPCZ DPOUBJOFSE DSJP SLUMFU SVOD SLU SBJMDBS  MYE MYD IBDPOJXB ࣮ࡍʹɺΧʔωϧͷ γεςϜίʔϧΛݺͿͳͲͯ͠ ίϯςφϓϩηεΛ࡞੒͢Δ
  17. 101.

    ͜Ε͔Β Χʔωϧࣗମ Χʔωϧ֦ுͳͲ γεςϜίʔϧ /BNFTQBDF DHSPVQ $BQBCJMJUZ DISPPU౳ TFDDPNQ 

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