emc world 2016 - code.02 introduction to immutable infrastructure

41
1 © Copyright 2016 EMC Corporation. All rights reserved. 1 © Copyright 2016 EMC Corporation. All rights reserved. INTRODUCTION TO IMMUTABLE INFRASTRUCTURE JONAS ROSLAND, EMC {code}

Upload: code-by-dell-emc

Post on 17-Jan-2017

296 views

Category:

Technology


3 download

TRANSCRIPT

Page 1: EMC World 2016 - code.02 Introduction to Immutable Infrastructure

1© Copyright 2016 EMC Corporation. All rights reserved. 1© Copyright 2016 EMC Corporation. All rights reserved.

INTRODUCTION TO IMMUTABLE INFRASTRUCTUREJONAS ROSLAND, EMC {code}

Page 2: EMC World 2016 - code.02 Introduction to Immutable Infrastructure

4© Copyright 2016 EMC Corporation. All rights reserved.

• What are we trying to solve?• How is immutable infrastructure different?• Tools and processes• Demo• Questions

AGENDA

Page 3: EMC World 2016 - code.02 Introduction to Immutable Infrastructure

5© Copyright 2016 EMC Corporation. All rights reserved.

• Updating an application means:– Shutting it down– Taking a backup of the app and its settings– Upgrading using packages and scripts– Starting the app and verify functionality

• Costly and error-prone• Rolling back is hard and time-consuming

TRADITIONAL APPROACH FOR APPLICATIONS

Page 4: EMC World 2016 - code.02 Introduction to Immutable Infrastructure

6© Copyright 2016 EMC Corporation. All rights reserved.

• Updating an infrastructure part means:– Taking a backup of its settings– Shutting it down– Upgrading using packages and scripts– Starting the system and verify functionality

• Costly and error-prone• Rolling back is hard and time-consuming

TRADITIONAL APPROACH FOR INFRA

Page 5: EMC World 2016 - code.02 Introduction to Immutable Infrastructure

7© Copyright 2016 EMC Corporation. All rights reserved.

There must be a better way!

Page 6: EMC World 2016 - code.02 Introduction to Immutable Infrastructure

8© Copyright 2016 EMC Corporation. All rights reserved.

Let’s introduceImmutable Infrastructure

Page 7: EMC World 2016 - code.02 Introduction to Immutable Infrastructure

9© Copyright 2016 EMC Corporation. All rights reserved.

A strategy for managing services in which infrastructure is divided into

DATA and EVERYTHING ELSE

Page 8: EMC World 2016 - code.02 Introduction to Immutable Infrastructure

10© Copyright 2016 EMC Corporation. All rights reserved.

EVERYTHING ELSE is replacedat every deployment rather than being

updated in-place

Page 9: EMC World 2016 - code.02 Introduction to Immutable Infrastructure

11© Copyright 2016 EMC Corporation. All rights reserved.

• Use layers for your infrastructure and applications• Each layer needs to be versioned• Versioning enables verification/control and rollback• Smart tools enables automated code checks,

inventory management, deployments and rollbacks

SO HOW WOULD THIS WORK?

Page 10: EMC World 2016 - code.02 Introduction to Immutable Infrastructure

12© Copyright 2016 EMC Corporation. All rights reserved.

• Full control over every version that gets deployed• No more snowflake servers• No more “I wonder if this has the right Java version”

AVOID CONFIGURATION DRIFT

Page 11: EMC World 2016 - code.02 Introduction to Immutable Infrastructure

13© Copyright 2016 EMC Corporation. All rights reserved.

ScaleIO

CentOS

Python App

Ruby App Java App

Page 12: EMC World 2016 - code.02 Introduction to Immutable Infrastructure

14© Copyright 2016 EMC Corporation. All rights reserved.

ScaleIO 2.0

CentOS 6.5

Python App

v10.2

Ruby Appv2.3

Java Appv1.4

Page 13: EMC World 2016 - code.02 Introduction to Immutable Infrastructure

15© Copyright 2016 EMC Corporation. All rights reserved.

ScaleIO 2.0

CentOS 7

Python App

v10.2

Ruby Appv2.3

Java Appv1.4

Page 14: EMC World 2016 - code.02 Introduction to Immutable Infrastructure

16© Copyright 2016 EMC Corporation. All rights reserved.

ScaleIO 2.0

CentOS 7

Python App

v10.3

Ruby Appv2.4

Java Appv1.5

Page 15: EMC World 2016 - code.02 Introduction to Immutable Infrastructure

17© Copyright 2016 EMC Corporation. All rights reserved.

• Use standardized methods for packaging applications with their requirements– Containers– PaaS systems– Configuration management systems

• They are all being used in production environments world-wide, there’s no reason for you to not use them

LAYERS – APPLICATIONS

Page 16: EMC World 2016 - code.02 Introduction to Immutable Infrastructure

18© Copyright 2016 EMC Corporation. All rights reserved.

• You need something to run your app on• Handle the OS as a static binary• Got a new Windows/Linux update?

Update the template you’re using!• Create OS images for all your needs

– VM templates– Vagrant boxes– AWS AMIs– OpenStack images

LAYERS – OPERATING SYSTEM

Page 17: EMC World 2016 - code.02 Introduction to Immutable Infrastructure

19© Copyright 2016 EMC Corporation. All rights reserved.

• Tools like Puppet, Chef, Ansible etc are used to “bake” the OS images• Can be used to create immutable objects such as

container images with your applications• Not used to modify running systems

CONFIGURATION MGMT CAVEAT

Page 18: EMC World 2016 - code.02 Introduction to Immutable Infrastructure

20© Copyright 2016 EMC Corporation. All rights reserved.

• Firmware/software plus configuration• If you have to click somewhere to enable settings

that cannot be pushed onto it, the system isn’t ready• Most physical appliances are not built for this, yet• Use DHCP as much as possible for easy network

management

LAYERS – SOFTWARE-DEFINED INFRA

Page 19: EMC World 2016 - code.02 Introduction to Immutable Infrastructure

21© Copyright 2016 EMC Corporation. All rights reserved.

RackHD

Page 20: EMC World 2016 - code.02 Introduction to Immutable Infrastructure

22© Copyright 2016 EMC Corporation. All rights reserved.

• Always create new versions when you’re changing something• Otherwise you have nothing to roll back to• Only roll out versioned changes!• For real, don’t even think of adding that small little

change to a live system• Store all changes in a version control system!

VERSIONING

Page 21: EMC World 2016 - code.02 Introduction to Immutable Infrastructure

23© Copyright 2016 EMC Corporation. All rights reserved.

• Write the small change somewhere, creating a new version• Test it• If it passes, roll it out in the correct way depending

on the layer in question• If it fails, try again with another incremental small

change

VERSIONING, CONTINUED

Page 22: EMC World 2016 - code.02 Introduction to Immutable Infrastructure

24© Copyright 2016 EMC Corporation. All rights reserved.

• App A requires Java, doesn’t specify version• You bake a CentOS 6.5 OS with Java 1.7• Deploy the app, it fails• You create a new version, CentOS 7 with Java 1.8• Deploy the app, it works• Roll out CentOS 7 with Java 1.8

EXAMPLE OF VERSIONING AND TESTING

Page 23: EMC World 2016 - code.02 Introduction to Immutable Infrastructure

25© Copyright 2016 EMC Corporation. All rights reserved.

• App A is in a container• You bake a CentOS 7 OS with Docker• Deploy the containerized app, it works• You create a new version of the app• A new container is built• Deploy the container, it works

EXAMPLE OF CONTAINER BASED DEPLOYMENT

Page 24: EMC World 2016 - code.02 Introduction to Immutable Infrastructure

26© Copyright 2016 EMC Corporation. All rights reserved.

• Knowing what’s deployed at all times is critical when lowering deployment failure rates• No one likes to be stuck at work for an entire

weekend and then roll back on Sunday night because of unforeseen issues• Having version control lets you know exactly what’s

deployed

CONTROL

Page 25: EMC World 2016 - code.02 Introduction to Immutable Infrastructure

27© Copyright 2016 EMC Corporation. All rights reserved.

So what tools can youuse to accomplish this?

Page 26: EMC World 2016 - code.02 Introduction to Immutable Infrastructure

28© Copyright 2016 EMC Corporation. All rights reserved.

• Containers (Docker, Rkt, LXC)– Put an application and its requirements in a container, then

you can deploy it thousand fold with consistent result• PaaS systems (Cloud Foundry, Deis, Heroku)

– Takes your code and automatically adds the defined versions of requirements, then runs it for you

• Configuration management systems– Puppet, Chef, Ansible, Salt– Can be used to create container images (remember the

caveat)

TOOLS - APPLICATIONS

Page 27: EMC World 2016 - code.02 Introduction to Immutable Infrastructure

29© Copyright 2016 EMC Corporation. All rights reserved.

FROM python:2.7.11

RUN mkdir /app

WORKDIR /app

COPY * .

RUN pip install -r requirements.txt

EXPOSE 5000

CMD [ "python", "./simple.py" ]

EXAMPLE – PYTHON APP IN A CONTAINER

Page 28: EMC World 2016 - code.02 Introduction to Immutable Infrastructure

30© Copyright 2016 EMC Corporation. All rights reserved.

• “Baking” images is critical to make sure you don’t have configuration drift (Packer)• Configuration management systems

– There to make sure services and OS settings are correctly applied in the baked image

• Deployment (RackHD, Terraform, Vagrant)– Deploying an OS is now seen as standard fare, not

something just done once

TOOLS – OPERATING SYSTEM

Page 29: EMC World 2016 - code.02 Introduction to Immutable Infrastructure

31© Copyright 2016 EMC Corporation. All rights reserved.

EXAMPLE – BAKING WORKFLOW

ISO Packer

VMTemplate

AWSImage

OpenStack ImageConfig Puppet

Terraform

VMware

AWS

OpenStack

Version controlledVersion controlled

Version controlled

Version controlled

Version controlled

Version controlled Version controlledVersion controlled

Version controlled

Version controlled

Version controlled

Page 30: EMC World 2016 - code.02 Introduction to Immutable Infrastructure

32© Copyright 2016 EMC Corporation. All rights reserved.

Page 31: EMC World 2016 - code.02 Introduction to Immutable Infrastructure

33© Copyright 2016 EMC Corporation. All rights reserved.

Page 32: EMC World 2016 - code.02 Introduction to Immutable Infrastructure

34© Copyright 2016 EMC Corporation. All rights reserved.

resource "vsphere_virtual_machine" ”docker-host-12" { name = “docker-host-01“ domain = “corp.local“ datacenter = “DC-02" cluster = “Cluster-03" vcpu = 4 memory = 32768 disk { datastore = “XTREMIO-04" template = "templates/docker-1.10-centos-7.0-x86_64” iops = 10000 } gateway = “192.168.1.1" network_interface { label = “CORP-LAN" ip_address = “192.168.1.112" subnet_mask = “255.255.255.0" }}

EXAMPLE – DEPLOYMENT OF DOCKER 1.10

Page 33: EMC World 2016 - code.02 Introduction to Immutable Infrastructure

35© Copyright 2016 EMC Corporation. All rights reserved.

resource "vsphere_virtual_machine" ”docker-host-12" { name = “docker-host-01“ domain = “corp.local“ datacenter = “DC-02" cluster = “Cluster-03" vcpu = 4 memory = 32768 disk { datastore = “XTREMIO-04" template = "templates/docker-1.11-centos-7.0-x86_64” iops = 10000 } gateway = “192.168.1.1" network_interface { label = “CORP-LAN" ip_address = “192.168.1.112" subnet_mask = “255.255.255.0" }}

EXAMPLE – DEPLOYMENT OF DOCKER 1.11

Page 34: EMC World 2016 - code.02 Introduction to Immutable Infrastructure

36© Copyright 2016 EMC Corporation. All rights reserved.

• Deployment– RackHD, Puppet, Chef, Ansible– VMware Auto Deploy, Arista Zero Touch Provisioning

• Monitoring– Sensu, Prometheus, Zabbix, Nagios

• Logging– Logstash, Splunk, Fluentd

TOOLS – SOFTWARE-DEFINED INFRA

Page 35: EMC World 2016 - code.02 Introduction to Immutable Infrastructure

38© Copyright 2016 EMC Corporation. All rights reserved.

• Immutable infrastructure lets you version control your datacenter• Rollbacks are now really just new deployments• Enables you to create layers and use the best tools

for different purposes• Testable and reliable, no more snowflakes

SUMMARY

Page 36: EMC World 2016 - code.02 Introduction to Immutable Infrastructure

39© Copyright 2016 EMC Corporation. All rights reserved.

Before opening up for questions

Page 37: EMC World 2016 - code.02 Introduction to Immutable Infrastructure

40© Copyright 2016 EMC Corporation. All rights reserved.

• Hands-on lab with Docker, Mesos and REX-Ray• Free stickers at our booth• Join our community at community.emccode.com• See all our projects at emccode.com• And follow us on Twitter @EMCcode

CONTINUE THE DISCUSSION

Page 38: EMC World 2016 - code.02 Introduction to Immutable Infrastructure

41© Copyright 2016 EMC Corporation. All rights reserved.

Data Persistence in the New Container WorldWednesday 3PM

Joshua BernsteinVP of Technology for ETD

Tobi Knaup CEO & Co-Founder of Mesosphere

Guru Session

Page 39: EMC World 2016 - code.02 Introduction to Immutable Infrastructure

42© Copyright 2016 EMC Corporation. All rights reserved.

@EMCcode@jonasrosland

emccode.comcommunity.emccode.com

Come visit us at Booth #1044 or in the vLab

Questions?

Page 40: EMC World 2016 - code.02 Introduction to Immutable Infrastructure

44© Copyright 2016 EMC Corporation. All rights reserved. 44© Copyright 2016 EMC Corporation. All rights reserved.

Page 41: EMC World 2016 - code.02 Introduction to Immutable Infrastructure