More developers on DevOps with Docker orchestration

Post on 09-Feb-2017

207 views 2 download

Transcript of More developers on DevOps with Docker orchestration

more DEVs on DEVOPS

with

DOCKER ORCHESTRATION

All the Things you have to Know in Order to use docker with Orchestration in Production like I did but not really like i did it because I cried, I really cried hard, so please do not cry because life is short

and you should spend your time enjoying it.

2 .@liuggio Giulio De Donato

@liuggio

welcometothebundle.co

m

more DEVs on DEVOPS

with

DOCKER ORCHESTRATION

All the Things you have to Know in Order to use docker with Orchestration in Production like I did but not really like i did it because I cried, I really cried hard, so please do not cry because life is short

and you should spend your time enjoying it.

@liuggio Giulio De Donato

1 Docker Container!==

@liuggio Giulio De Donato

Virtualization !== ContainerContainer are mostly syscalls2

@liuggio Giulio De Donato

3 It is all about

while true; do mkdir x; cd x; done

bomb() { bomb | bomb & }; bombISOLATIO

N

@liuggio Giulio De Donato

4 DevOps is ...

The perfect Storm

●VELOCITY●Variation ●Visualizati

onLEAD TIME

Three way devops:

@liuggio Giulio De Donato

Infrastructure like a managed application5 Infrastructure like a managed application

@liuggio Giulio De Donato

6 Use the FORCETHE DOCKER

WAY

One process per container

@liuggio Giulio De Donato

7 Use the FORCETHE DOCKER

WAY

log to StdErr and StdOut

@liuggio Giulio De Donato

Can’t touch thisImmutability8

@liuggio Giulio De Donato

9 Use the FORCETHE DOCKER

WAY

Env. Variable all the things

/etc/php5/fpm/pool.d/www.confclear_env = no

[www]env[MY_ENV_VAR_1] = 'value1'env[MY_ENV_VAR_2] = 'value2'

@liuggio Giulio De Donato

10

Containers communication is easy

NGINX PHP-FPM

Data (code)

php-cli

@liuggio Giulio De Donato

Cache

DB

10

Containers communication is easy

Backend

exposeport 80

Fairly easy

... Services

NGINX PHP-FPM

Data (code)

php-cli

@liuggio Giulio De Donato

Cache

DB

10

Containers communication is easy

N

N

N

NPHP

PHP

PHP

CLI

exposeport 80

Load balancer

Random port

Random port

Random port .

Random port .

Fairly easytricky

... Scale

NGINX PHP-FPM

Data (code)

php-cli

@liuggio Giulio De Donato

10

Containers communication is easy

N

N

N

NPHP

PHP

PHP

CLI

exposeport 80

Load balancer

Fairly easy

NODE 3

tricky NODE 2

NODE 1

Very tricky

... Nodes

NGINX PHP-FPM

Data (code)

php-cli

@liuggio Giulio De Donato

10

Containers communication is easy

Cache

DB

Fairly easytrickyVery tricky

... SubNet

A mess!

@liuggio Giulio De Donato

10

Containers communication is easy Fairly

easytrickyVery tricky

... MicroservicesNGINX

PHP-FPM

Data (code)

php-cli

Cache

DB

NGINX

PHP-FPM

Data (code)

php-cli

Cache

DBNGINX

PHP-FPM

Data (code)

php-cli

Cache

DB

NGINX

PHP-FPM

Data (code)

php-cli

Cache

DBNGINX

PHP-FPM

Data (code)

php-cli

Cache

DB

NGINX

PHP-FPM

Data (code)

php-cli

Cache

DB

A mess!NGINX

PHP-FPM

Data (code)

php-cli

NGINX

PHP-FPM

Data (code)

php-cli

Cache

DB

Cache

DB

NGINX

PHP-FPM

Data (code)

php-cli

Cache

DB

NGINX

PHP-FPM

Data (code)

php-cli

Cache

DB

NGINX

PHP-FPM

Data (code)

php-cli

Cache

DB

NGINX

PHP-FPM

Data (code)

php-cli

Cache

DB

NGINX

PHP-FPM

Data (code)

php-cli

Cache

DB

NGINX

PHP-FPM

Data (code)

php-cli

Cache

DB

@liuggio Giulio De Donato

10

Containers communication is easy Fairly

easytrickyVery trickyNOT FOR

HUMAN!!!! A mess!

@liuggio Giulio De Donato

11 Orchestration !==

Automation

●Kubernetes●Docker Cloud●DOCKER UCP●MESOS●Provisioning

tool (BASHISM/…)

●…

Docker Orchestration frameworks/tools

@liuggio Giulio De DonatoDEMO

Devops:The last human action happens when you commit?

@liuggio Giulio De Donato

@liuggio Giulio De Donato

12

Understand your processes

CODE TEST DEPLOY

@liuggio Giulio De Donato

13

Blue Green Deployment

LoadBalancer

Web Blue

Web Green

@liuggio Giulio De Donato

12 My pipeline (contd)

CODE

BUILD

CHOOSE NODES

Register Services

RUN Containe

rs(blue-green)

Integration

tests

Configure Proxy

with color

PostIntegrati

ontest

PUSH toregistry

TEST

PULL CONTAIN

ER

YOUR CUSTOMERS ARE HAPPY

@liuggio Giulio De Donato

14

Container registry and service discovery

CONSUL

@liuggio Giulio De Donato

12 My pipeline (contd)

CODE

BUILD

CHOOSE NODES

Register Services

RUN Containe

rs(blue-green)

Integration

tests

Configure Proxy

with color

PostIntegrati

ontest

PUSH toregistry

TEST

PULL CONTAIN

ER

YOUR CUSTOMERS ARE HAPPY

@liuggio Giulio De Donato15 Graceful Deployment

(contd)

LoadBalancer

Web

New Web Feature

@liuggio Giulio De Donato

16

You’ll need a lot of disk space

@liuggio Giulio De Donato

17 Resources ...

@liuggio Giulio De Donato

18

CONTAINER SERVICE A

CONTAINER SERVICE A

CONTAINER SERVICE A

CONTAINER SERVICE B

CONTAINER SERVICE B

CONTAINER SERVICE B

@liuggio Giulio De Donato

18

DNS SRV is your friend

CONTAINER SERVICE A

CONTAINER SERVICE A

CONTAINER SERVICE A

CONTAINER SERVICE B

CONTAINER SERVICE B

CONTAINER SERVICE B

@liuggio Giulio De Donato

18

DNS SRV is your friend

$ dig @192.168.99.100 bash_server.service.dc1.consul. SRV

@liuggio Giulio De Donato

$consulHost = "bash_server.service.dc1.consul.";$results = dns_get_record($consulHost, DNS_SRV);// $result["host"] // $result["port"]// $result["pri"]// $result["weight"]// $result["class"]// $result["ttl"]// $result["type"]// $result["target"]

DNS SRV is your friend

18

@liuggio Giulio De Donato

19

Use a log handler

-visualiz

e-

@liuggio Giulio De Donato

20 Fast is better

abc

Small Images eg. Alpine ~5mbDockerFile use layer cache wiselyBuild could be slow (if you don’t follow the docker-way)d Bad performance on large files

Winning Keys

DEMO --- THE PERFECT ORCHESTRATIONEasily DEPLOY

(LAST FEATURE PUSHED

gracefully)

Easily Rollback

(LAST PUSHED FEATURE

gracefully)Visualiz

eShare/Test/

Commit/Merge

Infrastructure

liuggio

THE PERFECT ORCHESTRATION

Processes respect your needs and:

- The Lead time is SHORT- The Feedback is FAST- The Improvement loop is

INFINITE@liuggio Giulio De Donato

few things you have to Know in Order to use

docker with Orchestration in Production like I did, but

not really like i did, because I cried, I really cried hard,

so please do not cry because life is short and

you should spend your time enjoying it.

Thank You @liuggio joind.in/talk/4b24e

@liuggio Giulio De Donato

● http://www.infoq.com/articles/continuous-deployment-containers● devops 2.0 the book● www.welcometothebundle.com/isolate-a-process-with-no-container-like-docker● https://github.com/opencontainers/runtime-spec/blob/master/config-linux.md#namespaces ● https://www.opencontainers.org/news/faqs/who-will-be-initial-technical-leadership ● http://www.cyberciti.biz/faq/unix-linux-chroot-command-examples-usage-syntax/● http://s0.cyberciti.org/uploads/faq/2013/01/bash-chroot-ls-demo.gif● https://www.flockport.com/lxc-vs-docker/● http://ramirose.wix.com/ramirosen● https://lwn.net/Articles/532593/● https://lwn.net/Articles/531114/● https://unsplash.com/photos/6wQId4r0uA4

CREDITS