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

はじめての英語プレゼン #6 LT - My first step of HashiCorp ...

はじめての英語プレゼン #6 LT - My first step of HashiCorp Nomad

はじめてのHashiCorp Nomad

Takaaki FURUKAWA

January 18, 2018
Tweet

More Decks by Takaaki FURUKAWA

Other Decks in Technology

Transcript

  1. About me • Takaaki Furukawa • Technical Account Manager •

    Chef Instructor • @tkak (twitter/github)
  2. HashiConf 17 • September 18-20, 2017, Austin, Texas • Main

    Topics • Terraform Enterprise, Terraform Module Registry • Vault k8s support • Nomad Enterprise, Nomad 0.7 (Web UI, ACL) • Consul 1.0 • Sentinel (Policy as Code)
  3. Nomad • Simple and lightweight application scheduler • Long lived

    services and short lived batch processing • Distributed system and Highly-Available • Multiple workload, not Docker optimistic • UNIX philosophy • Blue-green deployment / Canary deployment
  4. Trial environment • Nomad + consul • 3 servers +

    3 clients • CentOS 7 • Managed by Terraform + Chef Nomad Client Fabio App Nomad Server Nomad Client Fabio App Nomad Client Fabio App Nomad Server Nomad Server Load Balancer
  5. Deployment flow 1. Deploy fabio which is a simple HTTP

    proxy with consul 2. Deploy an example Go application, echoapp v1.0.0 3. Periodically access to “/version” API endpoint for checking 4. Deploy 1 echoapp v1.1.0 task as canary 5. Upgrade all echoapp tasks
  6. {"version":"1.0.0"} {"version":"1.0.0"} {"version":"1.0.0"} {"version":"1.1.0"} {"version":"1.0.0"} $ while true; do \

    curl -H 'Host: echoapp.foobar.co.jp' \ http://nomad-client0.foobar.jp.local:9999/version; \ sleep 1; \ done Canary deployment successfully!
  7. Future works • Investigation • Nomad enterprise (multi tenancy, resource

    isolation, sentinel) • Service mesh (istio, traefik, envoy, haproxy, nginx) • OpenFaaS + nomad
  8. References • 12-Factor Apps and the HashiStack • Keylsey Hightower

    • https://www.youtube.com/watch?v=Nosa5-xcATw • hashicorp/terraform-google-nomad • https://github.com/hashicorp/terraform-google-nomad • Fabio - Consul Load-Balancing made simple • https://github.com/fabiolb/fabio • Chef cookbook for nomad • https://github.com/tkak/nomad-agent-cookbook • An example application on nomad • https://github.com/tkak/echoapp
  9. + Job: "fabio" + Task Group: "fabio" (3 create) +

    Task: "fabio" (forces create) Scheduler dry-run: - All tasks successfully allocated. Job Modify Index: 0 To submit the job with version verification run: nomad run -check-index 0 fabio.nomad When running the job with the check-index flag, the job will only be run if the server side version matches the job modify index returned. If the index has changed, another user has modified the job and the plan's results are potentially invalid. $ nomad plan fabio.nomad
  10. ==> Monitoring evaluation "c6af39dd" Evaluation triggered by job "fabio" Allocation

    "21235cf3" created: node "e783830f", group "fabio" Allocation "2a03fa54" created: node "4bc3d8af", group "fabio" Allocation "6eefa6e6" created: node "093a8a6a", group "fabio" Evaluation status changed: "pending" -> "complete" ==> Evaluation "c6af39dd" finished with status "complete" $ nomad run fabio.nomad
  11. $ nomad status fabio ID = fabio Name = fabio

    Submit Date = 12/14/17 21:41:38 JST Type = system Priority = 50 Datacenters = dc1 Status = running Periodic = false Parameterized = false Summary Task Group Queued Starting Running Failed Complete Lost fabio 0 0 3 0 0 0 Allocations ID Node ID Task Group Version Desired Status Created At 21235cf3 e783830f fabio 0 run running 12/14/17 21:41:38 JST 2a03fa54 4bc3d8af fabio 0 run running 12/14/17 21:41:38 JST 6eefa6e6 093a8a6a fabio 0 run running 12/14/17 21:41:38 JST