the cloud is my laboratory, adam friedman

84
The cloud is my laboratory Experimenting with Docker Adam Friedman Dimension Data (ITaaS R&D) [email protected]

Upload: stephen-wallace

Post on 12-Jan-2017

104 views

Category:

Technology


2 download

TRANSCRIPT

Page 1: The cloud is my laboratory, Adam Friedman

The cloud is my laboratory Experimenting with Docker

Adam Friedman Dimension Data (ITaaS R&D) [email protected]

Page 2: The cloud is my laboratory, Adam Friedman

What this talk is about»

Page 3: The cloud is my laboratory, Adam Friedman

What this talk is about» Experimenting with Docker

Page 4: The cloud is my laboratory, Adam Friedman

What this talk is about» Experimenting with Docker (der)

Page 5: The cloud is my laboratory, Adam Friedman

What this talk is about» Experimenting with Docker

» Using virtualisation to reduce cycle time when trying out ideas

Page 6: The cloud is my laboratory, Adam Friedman

What this talk is about» Experimenting with Docker

» Using virtualisation to reduce cycle time when trying out ideas

» Using the cloud to achieve scale

Page 7: The cloud is my laboratory, Adam Friedman

What this talk is about» Experimenting with Docker

» Using virtualisation to reduce cycle time when trying out ideas

» Using the cloud to achieve scale

» Without breaking the bank

Page 8: The cloud is my laboratory, Adam Friedman

What I'd like to leave you with1.

Page 9: The cloud is my laboratory, Adam Friedman

What I'd like to leave you with1. We learn more from our failures than our successes

Page 10: The cloud is my laboratory, Adam Friedman

What I'd like to leave you with1. We learn more from our failures than our successes

2. Occam's razor

Page 11: The cloud is my laboratory, Adam Friedman

What I'd like to leave you with1. We learn more from our failures than our successes

2. Occam's razor (prefer to minimise variables)

Page 12: The cloud is my laboratory, Adam Friedman

What I'd like to leave you with1. We learn more from our failures than our successes

2. Occam's razor

» Aim for repeatability where possible

Page 13: The cloud is my laboratory, Adam Friedman

What I'd like to leave you with1. We learn more from our failures than our successes

2. Occam's razor

3. Virtualisation + automation make it cheap to experiment

Page 14: The cloud is my laboratory, Adam Friedman

What I'd like to leave you with1. We learn more from our failures than our successes

2. Occam's razor

3. Virtualisation + automation make it cheap to experiment

4. If experimentation is cheap enough, you can try out almost any idea you can come up with

Page 15: The cloud is my laboratory, Adam Friedman

What I'd like to leave you with1. We learn more from our failures than our successes

2. Occam's razor

3. Virtualisation + automation make it cheap to experiment

4. If experimentation is cheap enough, you can try out almost any idea you can come up with

» Think it's a silly idea? Prove it.

Page 16: The cloud is my laboratory, Adam Friedman

What I'd like to leave you with1. We learn more from our failures than our successes

2. Occam's razor

3. Virtualisation + automation make it cheap to experiment

4. If experimentation is cheap enough, you can try out almost any idea you can come up with

» Don’t be afraid to experiment!

Page 17: The cloud is my laboratory, Adam Friedman

Why I love Virtualisation Virtualisation is the bedrock on which most things cloud are built.

Page 18: The cloud is my laboratory, Adam Friedman

Why I love Virtualisation Virtualisation is the bedrock on which most things cloud are built.

It is the key to: »

Page 19: The cloud is my laboratory, Adam Friedman

Why I love Virtualisation Virtualisation is the bedrock on which most things cloud are built.

It is the key to: » Economies of scale

Page 20: The cloud is my laboratory, Adam Friedman

Why I love Virtualisation Virtualisation is the bedrock on which most things cloud are built.

It is the key to: » Economies of scale » Speed of provisioning

Page 21: The cloud is my laboratory, Adam Friedman

Why I love Virtualisation Virtualisation is the bedrock on which most things cloud are built.

It is the key to: » Economies of scale » Speed of provisioning » Repeatability

Page 22: The cloud is my laboratory, Adam Friedman

Why I love Virtualisation Virtualisation is the bedrock on which most things cloud are built.

It is the key to: » Economies of scale » Speed of provisioning » Repeatability

» The ability to readily and reliably duplicate an environment and its resources

Page 23: The cloud is my laboratory, Adam Friedman

Why I love the concept of CloudFor all its potential downsides, the cloud has vastly improved the process of experimentation:

Page 24: The cloud is my laboratory, Adam Friedman

Why I love the concept of CloudFor all its potential downsides, the cloud has vastly improved the process of experimentation:

» By selectively abstracting away levels of infrastructure, it enables us to focus on what we're trying to do

Page 25: The cloud is my laboratory, Adam Friedman

Why I love the concept of CloudFor all its potential downsides, the cloud has vastly improved the process of experimentation:

» By selectively abstracting away levels of infrastructure, it enables us to focus on what we're trying to do, rather than how to do it

Page 26: The cloud is my laboratory, Adam Friedman

Why I love the concept of CloudFor all its potential downsides, the cloud has vastly improved the process of experimentation:

» By selectively abstracting away levels of infrastructure, it enables us to focus on what we're trying to do, rather than how to do it

» Economies of scale also come into play:

Page 27: The cloud is my laboratory, Adam Friedman

Why I love the concept of CloudFor all its potential downsides, the cloud has vastly improved the process of experimentation:

» By selectively abstracting away levels of infrastructure, it enables us to focus on what we're trying to do, rather than how to do it

» Economies of scale also come into play:

» You can’t fit 20 servers under your desk

Page 28: The cloud is my laboratory, Adam Friedman

Why I love the concept of CloudFor all its potential downsides, the cloud has vastly improved the process of experimentation:

» By selectively abstracting away levels of infrastructure, it enables us to focus on what we're trying to do, rather than how to do it

» Economies of scale also come into play:

» You can’t fit 20 servers under your desk, but your cloud provider has plenty to spare (for as long as you need them)

Page 29: The cloud is my laboratory, Adam Friedman

Why I love the concept of CloudFor all its potential downsides, the cloud has vastly improved the process of experimentation:

» By selectively abstracting away levels of infrastructure, it enables us to focus on what we're trying to do, rather than how to do it

» Economies of scale also come into play:

» Most providers now charge only for what you actually use

Page 30: The cloud is my laboratory, Adam Friedman

Why I love the concept of CloudFor all its potential downsides, the cloud has vastly improved the process of experimentation:

» By selectively abstracting away levels of infrastructure, it enables us to focus on what we're trying to do, rather than how to do it

» Economies of scale also come into play

» Lower costs make it easier to explore a problem space, which helps to mitigate risk

Page 31: The cloud is my laboratory, Adam Friedman

Experimenting in the cloudThe trick to being productive when experimenting in the cloud:

» Get set up

Page 32: The cloud is my laboratory, Adam Friedman

Experimenting in the cloudThe trick to being productive when experimenting in the cloud:

» Get set up

» Do your experiment

Page 33: The cloud is my laboratory, Adam Friedman

Experimenting in the cloudThe trick to being productive when experimenting in the cloud:

» Get set up

» Do your experiment

» Clean up the evidence

Page 34: The cloud is my laboratory, Adam Friedman

Without breaking the bankThe trick to being productive when experimenting in the cloud:

» Get set up

» Do your experiment

» Clean up the evidence

» Before the mob arrives with pitchforks and flaming torches

Page 35: The cloud is my laboratory, Adam Friedman

Docker is great for experimenting

with new technologies

Page 36: The cloud is my laboratory, Adam Friedman

If you've heard of it, there's probably a Docker image of it.

Page 37: The cloud is my laboratory, Adam Friedman

If you've heard of it, there's probably a Docker image of it.

Example: What’s Neo4J?

Page 38: The cloud is my laboratory, Adam Friedman

If you've heard of it, there's probably a Docker image of it.

Example: What’s Neo4J?

docker run -p 7474:7474 neo4j

Page 39: The cloud is my laboratory, Adam Friedman

If you've heard of it, there's probably a Docker image of it.

Ok, how about RabbitMQ?

Page 40: The cloud is my laboratory, Adam Friedman

If you've heard of it, there's probably a Docker image of it.

Ok, how about RabbitMQ?

docker run -p 5672:5672 rabbitmq

Page 41: The cloud is my laboratory, Adam Friedman

If you've heard of it, there's probably a Docker image of it.

Ok, smartarse

Page 42: The cloud is my laboratory, Adam Friedman

If you've heard of it, there's probably a Docker image of it.

Ok, smartarse, but I bet there isn't one for cowsay

Page 43: The cloud is my laboratory, Adam Friedman

If you've heard of it, there's probably a Docker image of it.

Ok, smartarse, but I bet there isn't one for cowsay

docker run mwendler/cowsay "Sorry."

Page 44: The cloud is my laboratory, Adam Friedman

________< Sorry. > -------- \ ^__^ \ (oo)\_______ (__)\ )\/\ ||----w | || ||

Page 45: The cloud is my laboratory, Adam Friedman

That's super useful, but what if you're experimenting with docker itself?

Page 46: The cloud is my laboratory, Adam Friedman

That's super useful, but what if you're experimenting with docker itself?

docker-machine create docker1eval $(docker-machine env docker1)

Page 47: The cloud is my laboratory, Adam Friedman

That's super useful, but what if you're experimenting with docker itself?

docker-machine create docker1eval $(docker-machine env docker1)

Ok, but not very cloudy.

Page 48: The cloud is my laboratory, Adam Friedman

That's super useful, but what if you're experimenting with docker itself?

How about:

Page 49: The cloud is my laboratory, Adam Friedman

That's super useful, but what if you're experimenting with docker itself?

How about:

docker-machine create --driver amazonec2 docker1

docker-machine create --driver amazonec2 docker2

Page 50: The cloud is my laboratory, Adam Friedman

That's super useful, but what if you're experimenting with docker itself?

Or:

Page 51: The cloud is my laboratory, Adam Friedman

That's super useful, but what if you're experimenting with docker itself?

Or:

docker-machine create --driver digitalocean docker1

docker-machine create --driver digitalocean docker2

Page 52: The cloud is my laboratory, Adam Friedman

Docker Machine is nice

Page 53: The cloud is my laboratory, Adam Friedman

Docker Machine is nice, but it's opaque

Page 54: The cloud is my laboratory, Adam Friedman

Docker Machine is nice, but it's opaque

Sometimes that’s what you want.

Page 55: The cloud is my laboratory, Adam Friedman

Docker Machine is nice, but it's opaque

Sometimes that’s what you want (again, the focus may be on what you're trying to do).

Page 56: The cloud is my laboratory, Adam Friedman

Docker Machine is nice, but it's opaque

Sometimes that’s what you want (again, the focus may be on what you're trying to do, not how).

Page 57: The cloud is my laboratory, Adam Friedman

Docker Machine is nice, but it's opaque

Sometimes that’s what you want (again, the focus may be on what you're trying to do, not how).

Other times, not so much.

Page 58: The cloud is my laboratory, Adam Friedman

Docker Machine is nice, but it's opaque

Sometimes that’s what you want (again, the focus may be on what you're trying to do, not how).

Other times, not so much.

So what other options are there?

Page 59: The cloud is my laboratory, Adam Friedman

Do it by hand

You could do this at least once - a useful learning experience (especially for when things go wrong).

Page 60: The cloud is my laboratory, Adam Friedman

Automate it!

I'm probably preaching to the converted here :)

Page 61: The cloud is my laboratory, Adam Friedman

Infrastructure with Terraform

Declarative configuration for infrastructure

» Multi-cloud / multi-provider

» Repeatable

» Easy to consistently create / destroy / re-create infrastructure

But Terraform is only half the story. Once the infrastructure has been created, how do you get Docker itself deployed and configured?

Page 62: The cloud is my laboratory, Adam Friedman

Software with Ansible

» Hardly the only option out there, but if you're experimenting with throw-away systems then it's a good choice because it's just SSH (no master / agents to deploy)

» Chef Solo (or Chef Zero) is an alternative, but may still require more work to bootstrap each node

» Quick to get started (just run commands or modules on target machines)

» Scales up to Roles + Playbooks for repeatability

» Not great for managing large numbers of machines

Page 63: The cloud is my laboratory, Adam Friedman

Software with Ansible

» Can be run from Terraform (via a plug-in provisioner) but it's a lot easier to run it separately while you're experimenting.

» There are Ansible inventory plugins that can read a Terraform state file (so it knows server roles, host names, IP addresses, etc).

» Ansible Galaxy has modules for everything, including Docker (hint, hint)

» Beware if you are deploying an OS with only Python 3.x (Ansible needs 2.x)

Page 64: The cloud is my laboratory, Adam Friedman

A quick detour: Docker from simple to complex» Stand-alone

» Docker

» Orchestrated

» Local

» Docker Compose

» Clustered

» Docker Swarm

» Clustered with GUI

» Cattle / Rancher

» Kubernetes

» Mesos / Marathon

» Kitchen Sink

» Mantl

Note that simple and easy-to-use are not the same thing :)

Page 65: The cloud is my laboratory, Adam Friedman

Cisco Mantl

» Mantl is a microservices platform based on Docker, Mesos / Marathon, Consul, Traefik, Kubernetes, Calico, Contiv, etc (pretty much everything but the kitchen sink).

» Because it already includes several popular systems that extend / orchestrate Docker, it’s a useful starting point if you’re stuck trying to work out how to deploy or integrate a particular component

Page 66: The cloud is my laboratory, Adam Friedman

Cisco Mantl

» Mantl is deployed using Terraform with Ansible, and can therefore be deployed on a variety of clouds by swapping out Terraform modules as required.

» Their Ansible inventory plugin understands which cloud provider was used to create the infrastructure and so Ansible playbooks can adjust their behaviour to suit (if required).

Page 67: The cloud is my laboratory, Adam Friedman

Build your own lab

Page 68: The cloud is my laboratory, Adam Friedman

Build your own (throw-away) lab

Page 69: The cloud is my laboratory, Adam Friedman

Build your own (throw-away) lab

» Digital Ocean is fast Add Terraform and you can repeatedly create and destroy environments in seconds, rather than minutes.

» Obviously you can use AWS / Azure, too (or Dimension Data Cloud Control) but for quick-and-dirty experiments I prefer the simplest thing that works).

» Create an Ansible playbook to install Docker

» Start small - put everything in a single playbook and then move stuff out to separate reusable roles when needed

Page 70: The cloud is my laboratory, Adam Friedman

Build your own lab

4 servers (1 master, 3 workers).

lab.tf:

resource "digitalocean_droplet" "master" {

count = 1

image = "ubuntu-14-04-x64"

name = "master-${count.index + 1}"

region = "nyc2"

size = "1024mb"

}

resource "digitalocean_droplet" "worker" {

count = 4

image = "ubuntu-14-04-x64"

name = "worker-${count.index + 1}"

region = "nyc2"

size = "1024mb"

}

Page 71: The cloud is my laboratory, Adam Friedman

Build your own lab

» terraform apply

Page 72: The cloud is my laboratory, Adam Friedman

Build your own lab

» terraform apply

» …

Page 73: The cloud is my laboratory, Adam Friedman

Build your own lab

» terraform apply

» …

» Profit!

Page 74: The cloud is my laboratory, Adam Friedman

Build your own lab

» terraform apply

» …

» Profit!

» terraform destroy

Page 75: The cloud is my laboratory, Adam Friedman

Build your own lab

» terraform apply

» …

» Profit!

» terraform destroy

» No pitchforks

Page 76: The cloud is my laboratory, Adam Friedman

Build your own lab

» terraform apply

» …

» Profit!

» terraform destroy

» No pitchforks (probably)

Page 77: The cloud is my laboratory, Adam Friedman

Why not use Rancher / Docker Cloud?

» If all you want to do is deploy containers then these are a much better choice

Page 78: The cloud is my laboratory, Adam Friedman

Why not use Rancher / Docker Cloud?

» If all you want to do is deploy containers then these are a much better choice

» Rancher uses docker-machine to create nodes for you

Page 79: The cloud is my laboratory, Adam Friedman

Why not use Rancher / Docker Cloud?

» If all you want to do is deploy containers then these are a much better choice

» Rancher uses docker-machine to create nodes for you

» But this is a good choice if you want to learn about:

Page 80: The cloud is my laboratory, Adam Friedman

Why not use Rancher / Docker Cloud?

» If all you want to do is deploy containers then these are a much better choice

» Rancher uses docker-machine to create nodes for you

» But this is a good choice if you want to learn about:

» How to deploy docker

Page 81: The cloud is my laboratory, Adam Friedman

Why not use Rancher / Docker Cloud?

» If all you want to do is deploy containers then these are a much better choice

» Rancher uses docker-machine to create nodes for you

» But this is a good choice if you want to learn about:

» How to deploy docker

» Non-standard docker configurations

Page 82: The cloud is my laboratory, Adam Friedman

Why not use Rancher / Docker Cloud?

» If all you want to do is deploy containers then these are a much better choice

» Rancher uses docker-machine to create nodes for you

» But this is a good choice if you want to learn about:

» How to deploy docker

» Non-standard docker configurations

» It's useful to have a feeling for what's behind the UI

Page 83: The cloud is my laboratory, Adam Friedman

Links

» github.com/tintoy

» github.com/DimensionDataResearch

» mantl.io

» terraform.io

» ansible.com

» github.com/angstwad/docker.ubuntu

Page 84: The cloud is my laboratory, Adam Friedman

Questions?