Slide 1

Slide 1 text

Operating Rails in Kubernetes Kir Shatrov

Slide 2

Slide 2 text

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

Slide 3

Slide 3 text

Containers are awesome! *

Slide 4

Slide 4 text

Containerizing Rails: Techniques, Pitfalls, & Best Practices by Daniel Azuma Tomorrow 3:30pm

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

app01 app02 app03

Slide 8

Slide 8 text

app01 app02 app03

Slide 9

Slide 9 text

No content

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

Smart container scheduling for better utilization

Slide 13

Slide 13 text

Smart container scheduling for better utilization

Slide 14

Slide 14 text

Smart container scheduling for better utilization

Slide 15

Slide 15 text

Kubernetes basics: Pod

Slide 16

Slide 16 text

Kubernetes basics: Deployment

Slide 17

Slide 17 text

web jobs Kubernetes basics: Deployment

Slide 18

Slide 18 text

No content

Slide 19

Slide 19 text

No content

Slide 20

Slide 20 text

web jobs Kubernetes basics: Deployment

Slide 21

Slide 21 text

web jobs Kubernetes basics: Deployment

Slide 22

Slide 22 text

web jobs Kubernetes basics: Deployment

Slide 23

Slide 23 text

Managing Resources

Slide 24

Slide 24 text

YAML

Slide 25

Slide 25 text

No content

Slide 26

Slide 26 text

YAML apply when changed

Slide 27

Slide 27 text

YAML store in repository

Slide 28

Slide 28 text

No content

Slide 29

Slide 29 text

Deploy process controlling servers

Slide 30

Slide 30 text

Deploy process sequentially applying commands by SSH

Slide 31

Slide 31 text

Capistrano sequentially applying commands by SSH

Slide 32

Slide 32 text

No content

Slide 33

Slide 33 text

kubectl apply --file web.yml

Slide 34

Slide 34 text

kubectl apply --file jobs.yml

Slide 35

Slide 35 text

Controlling servers vs describing configuration

Slide 36

Slide 36 text

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

Slide 37

Slide 37 text

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

Slide 38

Slide 38 text

No content

Slide 39

Slide 39 text

It's easy to run a container,
 but not Rails

Slide 40

Slide 40 text

The Twelve-Factor app

Slide 41

Slide 41 text

No content

Slide 42

Slide 42 text

Disposability and termination

Slide 43

Slide 43 text

Web requests

Slide 44

Slide 44 text

Background Jobs

Slide 45

Slide 45 text

Long-running jobs

Slide 46

Slide 46 text

No content

Slide 47

Slide 47 text

Abort and re-enqueue

Slide 48

Slide 48 text

Concurrency scale out via the process model

Slide 49

Slide 49 text

No content

Slide 50

Slide 50 text

Assets

Slide 51

Slide 51 text

rake assets:precompile

Slide 52

Slide 52 text

Assets Shipped in container

Slide 53

Slide 53 text

Database Migrations

Slide 54

Slide 54 text

Migrations as a part of deploy

Slide 55

Slide 55 text

Migrations as a part of deploy

Slide 56

Slide 56 text

Asynchronous Migrations

Slide 57

Slide 57 text

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

Slide 58

Slide 58 text

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

Slide 59

Slide 59 text

Asynchronous Migrations

Slide 60

Slide 60 text

No content

Slide 61

Slide 61 text

No content

Slide 62

Slide 62 text

Secret Management

Slide 63

Slide 63 text

Secrets in the environment

Slide 64

Slide 64 text

Secrets in a container

Slide 65

Slide 65 text

Secrets in a container

Slide 66

Slide 66 text

Rails 5.2 Credentials

Slide 67

Slide 67 text

No content

Slide 68

Slide 68 text

ENV[‘RAILS_MASTER_KEY’]

Slide 69

Slide 69 text

The Twelve Factors Let workers terminate gracefully Migrations as a part of deploy can be fragile Rails 5.2 Credentials + Kubernetes Secrets

Slide 70

Slide 70 text

Kubernetes at Shopify

Slide 71

Slide 71 text

No content

Slide 72

Slide 72 text

Resource specs in YAML

Slide 73

Slide 73 text

No content

Slide 74

Slide 74 text

No content

Slide 75

Slide 75 text

No content

Slide 76

Slide 76 text

kubectl apply --file web.yml

Slide 77

Slide 77 text

No content

Slide 78

Slide 78 text

No content

Slide 79

Slide 79 text

Let robots help humans to migrate apps Developers don’t have to write YAML configs kubernetes-deploy brings visibility into rollout progress

Slide 80

Slide 80 text

No content

Slide 81

Slide 81 text

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

Slide 82

Slide 82 text

No content

Slide 83

Slide 83 text

No content

Slide 84

Slide 84 text

Thanks! @kirs @kirshatrov