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

1年ほどDC/OSを運用してみた話

wappy100
November 15, 2017
1.1k

 1年ほどDC/OSを運用してみた話

wappy100

November 15, 2017
Tweet

Transcript

  1. #PPUTUSBQ /PEF DC/OSΠϯετʔϧ  CPPUTUSBQ@VSMpMFPQUEDPT@JOTUBMM@UNQ DMVTUFS@OBNFDMVTUFSOBNF FYIJCJUPS@TUPSBHF@CBDLFOETUBUJD JQ@EFUFDU@QVCMJD@pMFOBNFQBUIUPJQTDSJQU NBTUFS@EJTDPWFSZTUBUJD NBTUFS@MJTU

    NBTUFSQSJWBUFJQ NBTUFSQSJWBUFJQ NBTUFSQSJWBUFJQ BHFOU@MJTU BHFOUQSJWBUFJQ BHFOUQSJWBUFJQ BHFOUQSJWBUFJQ BHFOUQSJWBUFJQ BHFOUQSJWBUFJQ QVCMJD@BHFOU@MJTU QVCMJDBHFOUQSJWBUFJQ SFTPMWFST   TTI@QPSU TTI@VTFSVTFSOBNF ΫϥελఆٛϑΝΠϧΛ༻ҙ
  2. Marathonఆٛ { "id": "/test/app", "container": { "type": "DOCKER", "docker": {

    "image": “nginx", "network": "BRIDGE", "portMappings": [ { "containerPort": 80, "protocol": "tcp", "labels": { "VIP_0": “/test/apps:8889" } } ] } }, "instances": 3, "cpus": 1, "mem": 1024 }
  3. Metronomeఆٛ { "id": "my-scheduled-job", "description": "A job that sleeps on

    a schedule", "run": { "cmd": "sleep 20000", "cpus": 0.01, "mem": 32, "disk": 0 }, "schedules": [ { "id": “sleep-nightly", "enabled": true, "cron": "20 0 * * *", "concurrencyPolicy": "ALLOW" } ] }
  4. εέʔϧΞ΢τ؆୯ • bootstrap αʔόʹ͋Δ shell Λ͖࣋ͬͯͯ ৽نϗετͰ࣮ߦ͢Δ͚ͩ $ curl -O

    http://dcos-boot.example.com/dcos_install.sh $ sudo bash dcos_install.sh slave
  5. MarathonϔϧενΣοΫͬͯʁ { "id": “/tools/app1", "container": { "type": "DOCKER", "docker": {

    "image": “nginx” } }, "healthChecks": [ { "protocol": "HTTP", "path": "/health", "gracePeriodSeconds": 60, "intervalSeconds": 15, "timeoutSeconds": 10 } ], "backoffSeconds": 2, "backoffFactor": 1.2, "maxLaunchDelaySeconds": 1200, "taskKillGracePeriodSeconds": 60, • MarathonλεΫ͕ਖ਼ৗʹՔಇ͍ͯ͠Δ͔ͷϔϧε νΣοΫػߏ • httpΤϯυϙΠϯτɺίϚϯυ࣮ߦͳͲͷఆ͕ٛՄೳ
  6. ಛఆͷ Marathon task ͕ Unhealty ʹͳͬͯ͠·͏ • kafka offset lag

    औಘ༻ʹ linkedin/burrow Λ ɹɹɹ DC/OS ্Ͱϗετ͍ͯͨ͠ • ͍͔ͭΒ͔ Unhealty ͱͳ͍ͬͯͨ ίί
  7. ಛఆͷ Marathon task ͕ Unhealty ʹͳͬͯ͠·͏ • Marathon ϔϧενΣοΫ༻ΤϯυϙΠϯτΛɺϝτϦΫε औಘ༻ͷΤϯυϙΠϯτͱͯ͠͠·͍ͬͯͨ

    http://{burrow}/metrics • kafka topic ͕૿͑ΔͨͼʹϨεϙϯεαΠζ͕૿͑ɺ Marathon ϔϧενΣοΫ͕ΤϥʔͱͳΔ https://github.com/mesosphere/marathon/issues/3289 • ϔϧενΣοΫ༻ͷΤϯυϙΠϯτΛ༻ҙͯ͠ରԠ
  8. ऴΘΒͳ͍ • image pull ࣦഊΈ͍ͨͳ task Failed ͕ى͖͍ͯΔΘ͚Ͱ ΋ͳ͍ •

    Ϧιʔε΋଍Γ͍ͯΔ • dcos marathon deployment stop (CLIπʔϧ) ΋ޮ͔ͳ͍
  9. ௚઀MarathonΛݟΔ • http://${MASTER_NODE_IP}/marathon/ui/ • task / deployment ͷ restart /

    destroy ΋ޮՌͳ͠ • destroy ͯ͠΋ suspended task Ͱ࢒ͬͯ͠·͏ɾɾ
  10. ίϯςφ͕৐͍ͬͯΔϗετΛݟΔ • docker ίϯςφ͕ϋϯάͯ͠ docker stop / kill / rm

    ͕ޮ͔ͳ͍ঢ়ଶ • deployment ͸ίϯςφͷ࡟আ଴ͪͰਐΜͰ͍ͳ͍༷ࢠ • docker rm -f Ͱڧ੍࡟আ͢Δ΋ mesos ͷ task ͱͯ͠͸࢒͍ͬͯΔ • ࠶౓Deployͯ͠΋ docker stop ॲཧ͔Β࢝·ͬͯ͠·͏ • Marathon task ID Λผͷ΋ͷʹͯ͠Deploy͢Δ͜ͱͰରॲͨ͠
  11. Marathonఆٛ { "id": "/test/apps", "container": { "type": "DOCKER", "docker": {

    "image": “nginx", "network": "BRIDGE", "portMappings": [ { "containerPort": 80, "protocol": "tcp", "labels": { "VIP_0": “/test/apps:8889" } } ] } }, "instances": 3, "cpus": 1, "mem": 1024 }
  12. Marathonఆٛ { "id": "/test/apps", "container": { "type": "DOCKER", "docker": {

    "image": “nginx", "network": "BRIDGE", "portMappings": [ { "containerPort": 80, "protocol": "tcp", "labels": { "VIP_0": “/test/apps:8889" } } ] } }, "instances": 3, "cpus": 1, "mem": 1024 }
  13. Lookup # dig testapps.marathon.l4lb.thisdcos.directory ; <<>> DiG 9.9.4-RedHat-9.9.4-29.el7_2.2 <<>> testapps.marathon.l4lb.thisdcos.directory

    ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 13203 ;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1 ;; WARNING: recursion requested but not available ;; OPT PSEUDOSECTION: ; EDNS: version: 0, flags:; udp: 4096 ;; QUESTION SECTION: ;testapps.marathon.l4lb.thisdcos.directory. IN A ;; ANSWER SECTION: testapps.marathon.l4lb.thisdcos.directory. 5 IN A 11.219.114.140 ;; Query time: 1 msec ;; SERVER: 198.51.100.1#53(198.51.100.1) ;; WHEN: Sun Nov 05 05:54:38 UTC 2017 ;; MSG SIZE rcvd: 86
  14. Lookup # curl testapps.marathon.l4lb.thisdcos.directory:8889 <!DOCTYPE html> <html> <head> <title>Welcome to

    nginx!</title> <style> body { width: 35em; margin: 0 auto; font-family: Tahoma, Verdana, Arial, sans-serif; } </style> </head> <body> <h1>Welcome to nginx!</h1>
  15. Τοοο # dig prd-ui.marathon.l4lb.thisdcos.directory ;; ANSWER SECTION: prd-ui.marathon.l4lb.thisdcos.directory. 5 IN

    A 11.214.212.58 prd-ui.marathon.l4lb.thisdcos.directory. 5 IN A 11.214.212.58 prd-ui.marathon.l4lb.thisdcos.directory. 5 IN A 11.214.212.58 prd-ui.marathon.l4lb.thisdcos.directory. 5 IN A 11.214.212.58 prd-ui.marathon.l4lb.thisdcos.directory. 5 IN A 11.214.212.58 prd-ui.marathon.l4lb.thisdcos.directory. 5 IN A 11.214.212.58 prd-ui.marathon.l4lb.thisdcos.directory. 5 IN A 11.214.212.58 prd-ui.marathon.l4lb.thisdcos.directory. 5 IN A 11.214.212.58 prd-ui.marathon.l4lb.thisdcos.directory. 5 IN A 11.214.212.58 prd-ui.marathon.l4lb.thisdcos.directory. 5 IN A 11.214.212.58 prd-ui.marathon.l4lb.thisdcos.directory. 5 IN A 11.214.212.58 prd-ui.marathon.l4lb.thisdcos.directory. 5 IN A 11.214.212.58 prd-ui.marathon.l4lb.thisdcos.directory. 5 IN A 11.214.212.58 prd-ui.marathon.l4lb.thisdcos.directory. 5 IN A 11.214.212.58 prd-ui.marathon.l4lb.thisdcos.directory. 5 IN A 11.214.212.58 prd-ui.marathon.l4lb.thisdcos.directory. 5 IN A 11.214.212.58 prd-ui.marathon.l4lb.thisdcos.directory. 5 IN A 11.214.212.58 prd-ui.marathon.l4lb.thisdcos.directory. 5 IN A 11.214.212.58
  16. ͠͹Β͘͢ΔͱANSWER͢Βฦ͞ͳ͘ͳΔ # dig prd-ui.marathon.l4lb.thisdcos.directory ; <<>> DiG 9.9.4-RedHat-9.9.4-38.el7_3.2 <<>> prd-ui.marathon.l4lb.thisdcos.directory

    ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 55428 ;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1 ;; OPT PSEUDOSECTION: ; EDNS: version: 0, flags:; udp: 4096 ;; QUESTION SECTION: ;prd-ui.marathon.l4lb.thisdcos.directory. IN A ;; AUTHORITY SECTION: thisdcos.directory. 130 IN SOA ns-1461.awsdns-54.org. awsdns- hostmaster.amazon.com. 1 7200 900 1209600 86400 ;; Query time: 1 msec ;; SERVER: 198.51.100.1#53(198.51.100.1) ;; WHEN: Sun Nov 05 15:31:03 JST 2017 ;; MSG SIZE rcvd: 153
  17. ͠͹Β͘͢ΔͱANSWER͢Βฦ͞ͳ͘ͳΔ # dig prd-ui.marathon.l4lb.thisdcos.directory ; <<>> DiG 9.9.4-RedHat-9.9.4-38.el7_3.2 <<>> prd-ui.marathon.l4lb.thisdcos.directory

    ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 55428 ;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1 ;; OPT PSEUDOSECTION: ; EDNS: version: 0, flags:; udp: 4096 ;; QUESTION SECTION: ;prd-ui.marathon.l4lb.thisdcos.directory. IN A ;; AUTHORITY SECTION: thisdcos.directory. 130 IN SOA ns-1461.awsdns-54.org. awsdns- hostmaster.amazon.com. 1 7200 900 1209600 86400 ;; Query time: 1 msec ;; SERVER: 198.51.100.1#53(198.51.100.1) ;; WHEN: Sun Nov 05 15:31:03 JST 2017 ;; MSG SIZE rcvd: 153
  18. ͠͹Β͘͢ΔͱANSWER͢Βฦ͞ͳ͘ͳΔ # dig prd-ui.marathon.l4lb.thisdcos.directory ; <<>> DiG 9.9.4-RedHat-9.9.4-38.el7_3.2 <<>> prd-ui.marathon.l4lb.thisdcos.directory

    ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 55428 ;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1 ;; OPT PSEUDOSECTION: ; EDNS: version: 0, flags:; udp: 4096 ;; QUESTION SECTION: ;prd-ui.marathon.l4lb.thisdcos.directory. IN A ;; AUTHORITY SECTION: thisdcos.directory. 130 IN SOA ns-1461.awsdns-54.org. awsdns- hostmaster.amazon.com. 1 7200 900 1209600 86400 ;; Query time: 1 msec ;; SERVER: 198.51.100.1#53(198.51.100.1) ;; WHEN: Sun Nov 05 15:31:03 JST 2017 ;; MSG SIZE rcvd: 153 ίϨ͸4QBSUBO %/41SPYZ
  19. Ͳ͏͔ͨ͠ • Load Balancing / VIP ൃߦ͍ͯ͠ΔMinutemanαʔϏε Λ࠶ىಈ͢Δ͜ͱͰରԠ • DC/OS

    1.9.0 ʹόʔδϣϯόοϓͨ͠Β࠶ൃ͠ͳ͘ͳͬͨ ʢݪҼ௥͑ͣʣ # systemctl restart dcos-minuteman.service # dig prd-ui.marathon.l4lb.thisdcos.directory +short 11.214.212.58
  20. ·ͱΊ • Mesos / Marathon / Metronome ·ΘΓͷ ஌͕ࣝඞཁ •

    ಺෦ίϯϙʔωϯτͷτϥϒϧγϡʔτ͕ ͭΒ͍ • k8sͱൺ΂Δͱ΍͸Γ৘ใྔ͕ɾɾɾ