Save 37% off PRO during our Black Friday Sale! »

Operating Rails in Kubernetes

Operating Rails in Kubernetes

My talk at RailsConf 2018.

C40db80709604a6868c769aca6367fb7?s=128

Kir Shatrov

April 17, 2018
Tweet

Transcript

  1. Operating Rails in Kubernetes Kir Shatrov

  2. 1. Intro to Kubernetes 2. Rails in Kubernetes 3. Shopify’s

    migration story
  3. Containers are awesome! *

  4. Containerizing Rails: Techniques, Pitfalls, & Best Practices by Daniel Azuma

    Tomorrow 3:30pm
  5. None
  6. None
  7. app01 app02 app03

  8. app01 app02 app03

  9. None
  10. None
  11. None
  12. Smart container scheduling for better utilization

  13. Smart container scheduling for better utilization

  14. Smart container scheduling for better utilization

  15. Kubernetes basics: Pod

  16. Kubernetes basics: Deployment

  17. web jobs Kubernetes basics: Deployment

  18. None
  19. None
  20. web jobs Kubernetes basics: Deployment

  21. web jobs Kubernetes basics: Deployment

  22. web jobs Kubernetes basics: Deployment

  23. Managing Resources

  24. YAML

  25. None
  26. YAML apply when changed

  27. YAML store in repository

  28. None
  29. Deploy process controlling servers

  30. Deploy process sequentially applying commands by SSH

  31. Capistrano sequentially applying commands by SSH

  32. None
  33. kubectl apply --file web.yml

  34. kubectl apply --file jobs.yml

  35. Controlling servers vs describing configuration

  36. Controlling servers Describing configuration running commands remotely comparing output with

    expected not prone to failures push configuration poll for it to apply abstracts from physical machines self-healing
  37. Controlling servers Describing configuration running commands remotely comparing output with

    expected not prone to failures push configuration poll for it to apply abstracts from physical machines self-healing
  38. None
  39. It's easy to run a container,
 but not Rails

  40. The Twelve-Factor app

  41. None
  42. Disposability and termination

  43. Web requests

  44. Background Jobs

  45. Long-running jobs

  46. None
  47. Abort and re-enqueue

  48. Concurrency scale out via the process model

  49. None
  50. Assets

  51. rake assets:precompile

  52. Assets Shipped in container

  53. Database Migrations

  54. Migrations as a part of deploy

  55. Migrations as a part of deploy

  56. Asynchronous Migrations

  57. 1. Change code and add a migration 1. Add a

    migration 2. Change code
  58. 1. Change code and add a migration 1. Add a

    migration 2. Change code
  59. Asynchronous Migrations

  60. None
  61. None
  62. Secret Management

  63. Secrets in the environment

  64. Secrets in a container

  65. Secrets in a container

  66. Rails 5.2 Credentials

  67. None
  68. ENV[‘RAILS_MASTER_KEY’]

  69. The Twelve Factors Let workers terminate gracefully Migrations as a

    part of deploy can be fragile Rails 5.2 Credentials + Kubernetes Secrets
  70. Kubernetes at Shopify

  71. None
  72. Resource specs in YAML

  73. None
  74. None
  75. None
  76. kubectl apply --file web.yml

  77. None
  78. None
  79. Let robots help humans to migrate apps Developers don’t have

    to write YAML configs kubernetes-deploy brings visibility into rollout progress
  80. None
  81. Kubernetes helps organizations to efficiently schedule workload and save resources

    It’s not magic, it only schedules and runs your containers Things you need to know about Rails
  82. None
  83. None
  84. Thanks! @kirs @kirshatrov