Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Operating Rails in Kubernetes
Search
Kir Shatrov
April 17, 2018
Programming
3
500
Operating Rails in Kubernetes
My talk at RailsConf 2018.
Kir Shatrov
April 17, 2018
Tweet
Share
More Decks by Kir Shatrov
See All by Kir Shatrov
Running Jobs at Scale
kirs
1
220
RailsClub 2016
kirs
2
320
Performance regressions in Ruby on Rails Core
kirs
0
230
Building a toolkit to detect performance regressions in Ruby on Rails core
kirs
3
5.9k
Развертывание веб-приложений и фреймворк Capistrano
kirs
1
290
Capistrano 3
kirs
4
2.9k
Other Decks in Programming
See All in Programming
Python’s True Superpower
hynek
0
190
TROCCOで実現するkintone+BigQueryによるオペレーション改善
ssxota
0
120
CSC307 Lecture 10
javiergs
PRO
1
690
Rails Girls Tokyo 18th GMO Pepabo Sponsor Talk
yutokyokutyo
0
180
要求定義・仕様記述・設計・検証の手引き - 理論から学ぶ明確で統一された成果物定義
orgachem
PRO
1
500
Swift ConcurrencyでよりSwiftyに
yuukiw00w
0
230
AIによる開発の民主化を支える コンテキスト管理のこれまでとこれから
mulyu
3
2.2k
文字コードの話
qnighy
43
16k
CSC307 Lecture 09
javiergs
PRO
1
850
登壇資料を作る時に意識していること #登壇資料_findy
konifar
4
2k
AI活用のコスパを最大化する方法
ochtum
0
120
コーディングルールの鮮度を保ちたい / keep-fresh-go-internal-conventions
handlename
0
120
Featured
See All Featured
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
950
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
59
50k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.4k
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
290
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
180
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
89
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
0
2.4k
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
Code Review Best Practice
trishagee
74
20k
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
220
How to Talk to Developers About Accessibility
jct
2
140
VelocityConf: Rendering Performance Case Studies
addyosmani
333
24k
Transcript
Operating Rails in Kubernetes Kir Shatrov
1. Intro to Kubernetes 2. Rails in Kubernetes 3. Shopify’s
migration story
Containers are awesome! *
Containerizing Rails: Techniques, Pitfalls, & Best Practices by Daniel Azuma
Tomorrow 3:30pm
None
None
app01 app02 app03
app01 app02 app03
None
None
None
Smart container scheduling for better utilization
Smart container scheduling for better utilization
Smart container scheduling for better utilization
Kubernetes basics: Pod
Kubernetes basics: Deployment
web jobs Kubernetes basics: Deployment
None
None
web jobs Kubernetes basics: Deployment
web jobs Kubernetes basics: Deployment
web jobs Kubernetes basics: Deployment
Managing Resources
YAML
None
YAML apply when changed
YAML store in repository
None
Deploy process controlling servers
Deploy process sequentially applying commands by SSH
Capistrano sequentially applying commands by SSH
None
kubectl apply --file web.yml
kubectl apply --file jobs.yml
Controlling servers vs describing configuration
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
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
None
It's easy to run a container, but not Rails
The Twelve-Factor app
None
Disposability and termination
Web requests
Background Jobs
Long-running jobs
None
Abort and re-enqueue
Concurrency scale out via the process model
None
Assets
rake assets:precompile
Assets Shipped in container
Database Migrations
Migrations as a part of deploy
Migrations as a part of deploy
Asynchronous Migrations
1. Change code and add a migration 1. Add a
migration 2. Change code
1. Change code and add a migration 1. Add a
migration 2. Change code
Asynchronous Migrations
None
None
Secret Management
Secrets in the environment
Secrets in a container
Secrets in a container
Rails 5.2 Credentials
None
ENV[‘RAILS_MASTER_KEY’]
The Twelve Factors Let workers terminate gracefully Migrations as a
part of deploy can be fragile Rails 5.2 Credentials + Kubernetes Secrets
Kubernetes at Shopify
None
Resource specs in YAML
None
None
None
kubectl apply --file web.yml
None
None
Let robots help humans to migrate apps Developers don’t have
to write YAML configs kubernetes-deploy brings visibility into rollout progress
None
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
None
None
Thanks! @kirs @kirshatrov