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

CoreOSで運用するために考えないといけないこと / CoreOS in pixiv

CoreOSで運用するために考えないといけないこと / CoreOS in pixiv

CoreOS Meetup Tokyo #1
2015-04-09

Harukasan

April 09, 2015
Tweet

More Decks by Harukasan

Other Decks in Technology

Transcript

  1. App App App App LB RPC RPC RPC RPC LB

    pixiv DBs manga-app DB CoreOS CoreOS CoreOS CoreOS ΦϯϓϨϛε IDCF Cloud Request flow Manage Manage L3 Private connect
  2. App App App App LB RPC RPC RPC RPC LB

    Manage pixiv DBs manga-app DB CoreOS Manage CoreOS CoreOS CoreOS fleetctl Jenkins pull pploy Deployment flow ΦϯϓϨϛε IDCF Cloud L3 Private connect
  3. App App App App LB RPC RPC RPC RPC LB

    pixiv DBs manga-app DB CoreOS Manage CoreOS CoreOS CoreOS Monitoring flow ΦϯϓϨϛε IDCF Cloud L3 Private connect td-agent td-agent td-agent td-agent dd-agent dd-agent dd-agent dd-agent Fluentd Logs Munin Nagios
  4. ਓͷԹ͔ΈΛײ͡ΔσϓϩΠ • cloud-configͰઃఆ͕ྲྀ͠ࠐ·ΕΔ • σϓϩΠ৬ਓʹΑΔϩʔϦϯάσϓϩΠ • fleetctlͰϦελʔτ͢Δ͜ͱͰσϓϩΠ͢Δ • ࣗಈԽ͍ͨ͠ export

     FLEETCTL_ENDPOINT=http://app-­‐1:4001/   NUM=1
 fleetctl  stop  app-­‐a@${NUM}.service
 fleetctl  start  app-­‐a@${NUM}.service  
  5. CoreOSΛͲ͏ଊ͍͑ͯΔͷ͔ • systemd + etcd/fleet/docker • αʔϏε؅ཧ͸͢΂ͯsystemd͕ߦ͏ • etcdΛ͔ͭͬͯΫϥελϦϯά͢Δ •

    fleetΛ͔ͭͬͯαʔϏεΛσϓϩΠ͢Δ • docker/rktΛ͔ͭͬͯίϯςφΠϝʔδΛ؅ཧ͢Δ • ͦͷ͏ͪউखʹΞοϓάϨʔυ͞ΕΔ • ͜ΕͰे෼ͩͬͨΒCoreOS͸બ୒ࢶʹͳΔ
  6. CoreOSΛͲ͏ଊ͍͑ͯΔͷ͔ • systemd + etcd/fleet/docker • αʔϏε؅ཧ͸͢΂ͯsystemd͕ߦ͏ • etcdΛ͔ͭͬͯΫϥελϦϯά͢Δ •

    fleetΛ͔ͭͬͯαʔϏεΛσϓϩΠ͢Δ • docker/rktΛ͔ͭͬͯίϯςφΠϝʔδΛ؅ཧ͢Δ • ͦͷ͏ͪউखʹΞοϓάϨʔυ͞ΕΔ • ͜ΕͰे෼ͩͬͨΒCoreOS͸બ୒ࢶʹͳΔ • ͜ΕҎ্ඞཁͳΒKubernetes͕ඞཁʹͳΔ
  7. Web Application in a Container • ΞϓϦέʔγϣϯϓϩηε͸ίϯςφʹ޲͍͍ͯΔ • 1ϓϩηεʢجຊతʹ͸ʣ •

    ґଘ͢ΔϥΠϒϥϦ͕ଟ͍ • ϝϞϦҎ֎ʹঢ়ଶΛ࣋ͨͳ͍ • LBͰϦΫΤετΛεΠονͰ͖Δ
  8. [Unit]   Description=app   After=docker.service   Requires=docker.service   [Service]  

    Restart=always   TimeoutStartSec=0   ExecStartPre=-­‐/usr/bin/docker  kill  app-­‐%i   ExecStartPre=-­‐/usr/bin/docker  rm  app-­‐%i   ExecStartPre=/usr/bin/docker  pull  …   ExecStart=/usr/bin/docker  run  —name  app-­‐%i  …   ExecStop=/usr/bin/docker  stop  app-­‐%i   [X-­‐Fleet]   Conflicts=app@*.service   [email protected]:
  9. ϞχλϦϯά • ͳʹΛϞχλϦϯά͠ͳ͍ͱ͍͚ͳ͍ͷ͔ • αʔϏεϨϕϧ • ϊʔυϨϕϧ • ίϯςφϨϕϧ •

    ͳΜͰ΋ݟͨ͘ͳΔ͚Ͳຊ౰ʹશ෦ݟͳ͍ͱ
 ͍͚ͳ͍ͷ͔ߟ͑Δඞཁ͕͋Δ • 1ϊʔυ=1ίϯςφͰಈ͔͢ͷͰ͋Ε͹ࠓ·ͰͲ͓Γ ͷϞχλϦϯάͱͦΜͳʹมΘΒͳ͍