Azure Bootcamp 2016 - Docker Orchestration on Azure with Rancher

41
Docker Orchestration on Azure with Rancher

Transcript of Azure Bootcamp 2016 - Docker Orchestration on Azure with Rancher

Docker Orchestration on Azure with Rancher

Who am I?

Cloud Solution Architect @ Xylos ICT

Started in IT about 15 years ago

Heterogeneous Background

Focused on Business Outcome

about.kvaes.be @kvaes blog.kvaes.be

Karim Vaes

Agenda

Let’s get sure everyone understands the basics…

“Docker 101”

Show me the cake!

“Hands-on!”

Cooking up things is cool… Though let’s talk about the

recipe first!

“The Recipe”

Sounds interesting… Show me!Say what?!?

Say what?!?

aka “Docker 101”

Traditional Current Emerging

Virtual Public Private

Container

Physical

Baremetal Virtual Machine

Private

N-tier Applications MicroservicesMonolithic Applications

Agile DevopsWaterfall

Build Ship

Run

Dev

QA

Source

Staging

Physical

Virtual

Cloud

Infrastructure Management

Infrastructure Management

DockerFile

Source Code Repository

TESTTEST

TESTTEST

TEST

GCE RAX IBM

Mac/Win Dev Machine

Boot2Docker

Dock

er

AnalyticsDB

Prod MachineLinux OS

Dock

erDo

cker

++

Users Collab

Provenance Policy

Docker Hub

Registries

Public Curated Private

Docker Hub API

Third Party Tools

Prod MachineLinux OS

Dock

erDo

cker

Prod MachineLinux OS

Dock

erDo

cker

VM

Dock

erDo

cker

VM

Dock

erDo

cker

VM

Dock

erDo

cker

QA MachineLinux OS

Dock

erDo

cker

Build once, ship & run everywhere!

Containers vs Virtual Machines

Sample Dockerfile# Pull the latest batch script ENV HOME /rootCOPY testblog.sh /data/bin/COPY testblogcron /data/bin/COPY startcron.sh /data/bin/

# Setup 755 on the scriptsRUN chmod 755 /data/bin/*.sh

# Setup Cron JobRUN cat /data/bin/testblogcron >> /etc/crontab

# Setup Cron LogRUN touch /var/log/testblog.log

# Define default command.CMD ["/data/bin/startcron.sh"]

# # BlogTest Dockerfile## Source : https://bitbucket.org/kvaes/docker-testblog/# Author : Karim Vaes

# Use Ubuntu 10.04 as a baseFROM ubuntu:10.04

# First let's do some updates!RUN apt-get update && apt-get -y upgrade

# Install cronRUN apt-get -y install cron

# Let's prep the directory RUN mkdir -p /data/bin

Basic Docker Flow

What about changes & updates?

What makes containers lightweight?

Sounds Interesting…

aka “The Recipe”

The Recipe for today’s dish!

A pinch of Rancher

One tablespoon of Docker

Two cups of Azure

A dressing of Community COntributions

Ingredient : Azure

Resource Manager

Traffic Manager

Virtual Machine Scale Set

Storage Account

Ingredient : Docker

Ingredient : Rancher

Ingredient : Community Contributions

Today’s Dish as a Stack

A pinch of Rancher

One tablespoon of Docker

Two cups of Azure

A dressing of Community COntributions

Show me!

aka “Hands-on”

Demo : Deploy our base setup

Demo : Deploy our base setupServer

Leave “nodesApi” blankSelect “Server” for “deploymentType”

Base ConfigurationSetup ACLBrowse to “Add Custom Host” & retrieve API url

NodesEnter API url in “nodesApi”Select “Nodes” for “deploymentType”Choose “2” as “nodesCount”

https://github.com/Azure/azure-quickstart-templates/tree/master/docker-rancher

Demo : Service Upgrade

Demo : Service Upgrade

Version 1

Version 2

https://bitbucket.org/kvaes/azure-bootcamp-2016/src => rancher-example_upgrade-blog-test

Demo : Cross-Region/Host Networking

Demo : Cross-Region Networking

[Sidenote : the Azure quickstart deployment was a single region]

Demo : Service Scaling with a Shared Storage Account

Demo : Service Scaling

t

Com

pute

InactivityPeriod

t

t

t

On and OffOn and off workloads (e.g. batch job)Over provisioned capacity is wasted Time to market can be cumbersome

Unpredictable BurstingUnexpected/unplanned peak in demand Sudden spike impacts performance Cannot over provision for extreme cases Co

mpu

te

Growing FastSuccessful services needs to grow/scale Keeping up with growth is a big IT challenge Cannot provision hardware fast enoughCo

mpu

te

Predictable BurstingServices with micro seasonality trends Peaks due to periodic increased demandIT complexity and wasted capacity

Com

pute

Demo : Service Scaling

ProducerAcsLoggingTestSimulate

ConsumerAcsLoggingTestAnalyze

Queue

Table

Storage Account

https://bitbucket.org/kvaes/azure-bootcamp-2016/src => rancher-example_acs-logging-test

Demo : Service Scaling

https://bitbucket.org/kvaes/azure-bootcamp-2016/src => rancher-example_acs-logging-test

Demo : Azure AutoScaling

Demo : Azure Autoscaling

[Sidenote: No Azure Quickstart templates available yet for Rancher & VMSS...]

Demo : Docker Volume Plugin for Azure File Storage

Volumes? #wtf# # OfxParser Dockerfile## Source : https://bitbucket.org/kvaes/docker-ofxparser/# Author : Karim Vaes

# Use Ubuntu 10.04 as a baseFROM ubuntu:10.04

# First let's do some updates!RUN apt-get update && apt-get -y upgrade

# Install PHP5-cli, cronRUN apt-get -y install php5-cli cron

# Let's prep the OfxParser installRUN mkdir -p /ofx/bin && mkdir -p /ofx/in && mkdir -p /ofx/out

# Pull the latest ofxparser sourceENV HOME /rootCOPY config.php /ofx/bin/COPY csv2oxf.php /ofx/bin/COPY ofxcron /ofx/bin/COPY parser.php /ofx/bin/COPY startcron.sh /ofx/bin/

# Chmod 755 to scriptsRUN chmod 755 /ofx/bin/*.sh

# Setup Cron JobRUN cat /ofx/bin/ofxcron >> /etc/crontab

# Setup Cron LogRUN touch /var/log/ofx.log

# Setup VolumesVOLUME ["/ofx/in"]VOLUME ["/ofx/out"]

# Define default command.CMD ["/ofx/bin/startcron.sh"]

Docker Volumes & Persistence

More info? https://kvaes.wordpress.com/2016/02/11/docker-storage-patterns-for-persistence/

Demo : Docker Volume Plugin for Azure File Storage

Source : https://github.com/Azure/azurefile-dockervolumedriver

Demo : Docker Volume Plugin for Azure File Storage

wget https://bitbucket.org/kvaes/azure-scriptbin/raw/888d4ff75d84839c8643fe0d9c49d95cd41c9a39/azurefile-dockervolumedriver/azurefile.sh

./azurefilebuild.sh my-storage-account-name my-storage-account-key

sudo docker volume create --name azure_volume -d azurefile -o share=dockerazure_volume docker run -i -t -v azure_volume:/data busyboxcd /data/touch karim vaes docker with azure file storage testls -laexit docker run -i -t -v azure_volume:/data ubuntucd /data/ls -lamkdir testdirectoryecho "my little cloud storage share" > whoot.txtexit docker run -i -t -v azure_volume:/data busyboxcat /data/whoot.txtexit

Source : https://kvaes.wordpress.com/2016/03/23/docker-azure-testdriving-the-azure-file-storage-volume-driver/

[Sidenote: Rancher currently does not support “options” for volume drivers][pending feature request]

One last thing…

Images courtesy of PokkO / Shutterstock.com, Lewis Hine - http://www.archives.gov/research_room/research_topics/american_cities/images/american_cities_069.jpg

The right approach to containers matters!

“Any questions I can help you with?”

Thank you for your time!

Xylos Cloud ServicesXylos Cloud Services