Slide 1

Slide 1 text

Cloud Anti-Patterns @caseywest 1 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 2

Slide 2 text

A word about consent… Please do: Take pictures, tweet, take notes. Please don't: Record or live stream without my explicit consent. 2 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 3

Slide 3 text

Cloud Anti-Patterns • Twitter @caseywest • Email [email protected] • Web http://caseywest.com 3 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 4

Slide 4 text

Thanks, Pivotal 4 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 5

Slide 5 text

Act One The five stages of cloud-native 5 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 6

Slide 6 text

The five stages of cloud- native 1. Denial 2. Anger 3. Bargaining 4. Depression 5. Acceptance 6 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 7

Slide 7 text

Have a seat on the couch 7 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 8

Slide 8 text

Whatever makes you comfortable 8 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 9

Slide 9 text

Now for some basic ground rules 9 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 10

Slide 10 text

Rules We will talk about your delivery pipeline 10 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 11

Slide 11 text

Rules We will talk about your architecture 11 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 12

Slide 12 text

Rules We will talk about your automation 12 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 13

Slide 13 text

⏰ 13 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 14

Slide 14 text

"Deploying my apps to 'the cloud' is paintful. Why?" 14 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 15

Slide 15 text

Denial 15 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 16

Slide 16 text

Denial Containers are just like tiny virtual machines 16 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 17

Slide 17 text

Denial We don't need to automate continuous delivery 17 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 18

Slide 18 text

Anger 18 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 19

Slide 19 text

Anger Works on my machine 19 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 20

Slide 20 text

Anger Dev is just #YOLO-ing shit to production 20 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 21

Slide 21 text

Bargaining 21 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 22

Slide 22 text

Bargaining We crammed this monolith into a container and called it a microservice 22 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 23

Slide 23 text

Bargaining "Bi-Modal IT" 23 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 24

Slide 24 text

Bargaining What if we create "microservices" that all talk to the same data source? 24 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 25

Slide 25 text

Depression 25 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 26

Slide 26 text

Depression We made 200 microservices and forgot to set up jenkins 26 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 27

Slide 27 text

Depression We have an automated build pipeline but release twice a year 27 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 28

Slide 28 text

Acceptance 28 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 29

Slide 29 text

Acceptance All software sucks 29 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 30

Slide 30 text

Acceptance Respect CAP Theorem 30 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 31

Slide 31 text

Acceptance Respect Conway's Law 31 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 32

Slide 32 text

Acceptance Small batch size works for replatforming, too 32 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 33

Slide 33 text

Acceptance Automate everything 33 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 34

Slide 34 text

⏰'s up 34 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 35

Slide 35 text

What have we learned? 35 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 36

Slide 36 text

Cloud-native operability is* 1. Microservices Architecture 2. Devops Culture 3. Continuous Delivery Pick Any Three * Not always true. 36 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 37

Slide 37 text

Act Two The twelve-factor container 37 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 38

Slide 38 text

You must be this tall to ride this ride 38 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 39

Slide 39 text

Audience Participation • Containers? • Schedulers? • Cloud? 39 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 40

Slide 40 text

Docker Docker Docker Docker Docker Docker Docker Docker 40 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 41

Slide 41 text

The factors http://12factor.net 41 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 42

Slide 42 text

1: One codebase tracked in revision control, many deploys 42 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 43

Slide 43 text

Anti-pattern Building separate images for staging and production 43 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 44

Slide 44 text

Anti-pattern Tags for dev and prod 44 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 45

Slide 45 text

Best Practice Use the environment and/or feature flags 45 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 46

Slide 46 text

2: Explicitly declare and isolate dependencies 46 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 47

Slide 47 text

2: Explicitly declare and isolate dependencies 47 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 48

Slide 48 text

Anti-pattern latest 48 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 49

Slide 49 text

Best Practice Declare version numbers of upstream dependencies 49 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 50

Slide 50 text

Best Practice Depend on base images for default filesystem and runtimes 50 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 51

Slide 51 text

3: Store config in the environment 51 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 52

Slide 52 text

Anti-pattern config.yml 52 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 53

Slide 53 text

Anti-pattern properties.xml 53 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 54

Slide 54 text

Anti-pattern Hard-coded feature flags 54 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 55

Slide 55 text

Best Practice This one is literally about environment variables 55 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 56

Slide 56 text

Best Practice This one is literally about environment variables ! ‑ 56 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 57

Slide 57 text

4: Treat backing services as attached resources 57 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 58

Slide 58 text

Anti-pattern Local disk 58 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 59

Slide 59 text

Anti-pattern Local disk 59 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 60

Slide 60 text

Anti-pattern Local disk 60 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 61

Slide 61 text

Best Practice Connect to network- attached services using connection info from the environment 61 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 62

Slide 62 text

5: Strictly separate build and run stages 62 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 63

Slide 63 text

Anti-pattern Install on deploy 63 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 64

Slide 64 text

Best Practice Build immutable images then run those images 64 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 65

Slide 65 text

Painfully Obvious Best Practices 1. Eat when hungry 2. Sleep when tired 3. Book Casey West for speaking gigs 65 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 66

Slide 66 text

Best Practice Respect the lifecycle: build, run, destroy 66 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 67

Slide 67 text

6: Execute the app as one or more stateless processes 67 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 68

Slide 68 text

Best Practice Schedule LRPs by distributing them across a cluster of physical hardware 68 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 69

Slide 69 text

Anti-pattern NFS 69 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 70

Slide 70 text

Anti-pattern NFS Need I say more? 70 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 71

Slide 71 text

7: Export services via port binding 71 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 72

Slide 72 text

Best Practice port = Env.fetch(:PORT) 72 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 73

Slide 73 text

Best Practice my $port = $ENV{PORT}; 73 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 74

Slide 74 text

Best Practice private String getPort() { Map env = System.getenv(); return env.get("PORT"); } 74 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 75

Slide 75 text

Best Practice let port = env::var("PORT").unwrap() 75 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 76

Slide 76 text

8: Scale out via the process model 76 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 77

Slide 77 text

Best Practice Horizontally scale by adding instances 77 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 78

Slide 78 text

9: Maximize robustness with fast startup and graceful shutdown 78 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 79

Slide 79 text

10: Keep development, staging, and production as similar as possible 79 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 80

Slide 80 text

Best Practice Run containers in development 80 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 81

Slide 81 text

11: Treat logs as event streams 81 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 82

Slide 82 text

Anti-pattern Random log files #yolo'd all over the file system 82 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 83

Slide 83 text

Best Practice STDOUT STDOUT STDOUT STDOUT 83 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 84

Slide 84 text

12: Run admin/ management tasks as one-off processes 84 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 85

Slide 85 text

Anti-pattern Custom containers for tasks 85 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 86

Slide 86 text

Best Practice Reuse application images with specific entrypoints for tasks 86 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 87

Slide 87 text

More factors? • API first • Secrets management • Health metrics • Global distribution 87 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 88

Slide 88 text

You are now cloud-native 88 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 89

Slide 89 text

Repeatability Reliability Resiliency 89 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry

Slide 90

Slide 90 text

@caseywest Let's be friends ! 90 ! @caseywest #containercon #linuxcon #containers #realworld #sorrynotsorry