ha kubernetes on mesos / marathon

45
Docker on Kubernetes

Upload: cobus-bernard

Post on 21-Jan-2018

275 views

Category:

Internet


0 download

TRANSCRIPT

Page 1: HA Kubernetes on Mesos / Marathon

Docker on Kubernetes

Page 2: HA Kubernetes on Mesos / Marathon

Thank you@planet for the snacks

22seven for the venue

Blue Battleship for the drinks

(^^^ shameless self promotion)

Page 3: HA Kubernetes on Mesos / Marathon

ActuallyDocker on Kubernetes

on Mesos via Marathon

in VirtualBox via Vagrant

Provisioned with Chef

Page 4: HA Kubernetes on Mesos / Marathon

Relax and listenAll the code and commands will

be available online after the talk

Page 5: HA Kubernetes on Mesos / Marathon
Page 6: HA Kubernetes on Mesos / Marathon

What is Docker?According to Google:

person employed in a port to load and unload ships.

Page 7: HA Kubernetes on Mesos / Marathon

Docker containers wrap up a piece of software in a

complete filesystem that contains everything it needs

to run: code, runtime, system tools, system libraries

– anything you can install on a server. This

guarantees that it will always run the same,

regardless of the environment it is running in.

Page 8: HA Kubernetes on Mesos / Marathon
Page 9: HA Kubernetes on Mesos / Marathon

Why is this important?Creates a standard way to ship build artifacts

Ships the exact binary the developer had

Page 10: HA Kubernetes on Mesos / Marathon

<Stock photo for docker presentation>

Page 11: HA Kubernetes on Mesos / Marathon

So you have containersNow what?

Let’s deploy!

Page 12: HA Kubernetes on Mesos / Marathon

Where do you host them?Docker Hub (public, security)

AWS ECR

Private Docker registry

Page 13: HA Kubernetes on Mesos / Marathon

How do you deploy?Command line

Page 14: HA Kubernetes on Mesos / Marathon

High hardware utilizationIdling systems wastes money

Page 15: HA Kubernetes on Mesos / Marathon

Ok, so let’s spin up moreUse each server for multiple services

Forward the ports to the same on host

Put a loadbalancer in front

Pat back, just scaled horizontally

Page 16: HA Kubernetes on Mesos / Marathon

IssuesHow do the nodes in a service discover other ones

to allow them to cluster?

Page 17: HA Kubernetes on Mesos / Marathon

Chef!(My new koolaid driven tool)

Ansible is also cool, ask Tom

Page 18: HA Kubernetes on Mesos / Marathon
Page 19: HA Kubernetes on Mesos / Marathon
Page 20: HA Kubernetes on Mesos / Marathon

Erm, riiiiiiightI’ve heard Mesos/Marathon can help with that

Page 21: HA Kubernetes on Mesos / Marathon

Are we there yet?I thought this talk was about Kubernetes

Page 22: HA Kubernetes on Mesos / Marathon

KubernetesGood for spinning up pods

Registering services

Etcd event -> Update DNS

Page 23: HA Kubernetes on Mesos / Marathon

PodsCollection of Docker images that work together

nginx + memcached

Independent, no shared state

Port inside container is mapped to host port

Page 24: HA Kubernetes on Mesos / Marathon

PodsMortal, when they die, they are gone

Sounds like something should watch them

Page 25: HA Kubernetes on Mesos / Marathon
Page 26: HA Kubernetes on Mesos / Marathon

Replication controllerMonitors the pods

Spins up or kills pods depending

on replication count required

Should be used for single pods

Page 27: HA Kubernetes on Mesos / Marathon

PodsIf the run on some host somewhere,

how do we find them?

Page 28: HA Kubernetes on Mesos / Marathon

ServicesHigher level abstraction

Website doesn’t care which instance,

just looking for image processing service

Has a port to pod port mapping

Page 29: HA Kubernetes on Mesos / Marathon
Page 30: HA Kubernetes on Mesos / Marathon

Port mappingService registers with Etcd -> DNS

Service port -> Pod port -> Container port

Starting to get complicated

myservice.etcd.local

Page 31: HA Kubernetes on Mesos / Marathon

Mesos / MarathonGood with scheduling tasks on nodes

Monitors and restarts processes

Assigns random ports to containers

Allows resource constraints

Page 32: HA Kubernetes on Mesos / Marathon

Consul + nginxConsul raises events when service is registerd

Consul-template -> generate nginx config

Load balance 2x nginx for *.mydomain.com

Page 33: HA Kubernetes on Mesos / Marathon

Mesos + KubernetesEasy, right?

Page 34: HA Kubernetes on Mesos / Marathon
Page 35: HA Kubernetes on Mesos / Marathon
Page 36: HA Kubernetes on Mesos / Marathon
Page 37: HA Kubernetes on Mesos / Marathon

What now?Vagrant + Virtualbox

Chef them

Sounds do-able

Page 38: HA Kubernetes on Mesos / Marathon

VagrantSpin up 3 Ubuntu machines

Provision with Chef

Page 39: HA Kubernetes on Mesos / Marathon

Eth0 vs Eth1Chef Ohai reads eth0

Needs to be eth1

Vagrant Ohai plugin!

Then it broke

Page 40: HA Kubernetes on Mesos / Marathon

Zookeeper

Mesos

MarathonNot too much pain

Page 41: HA Kubernetes on Mesos / Marathon

KubernetesLot’s of pain

Build from source

Build from source using Docker image

Download binary

Page 42: HA Kubernetes on Mesos / Marathon

KubernetesSpecifically didn’t choose to do single master

example, you wouldn’t run it like this in

production

Page 43: HA Kubernetes on Mesos / Marathon

KubernetesWatch Kelsey Hightower’s youtubes

Page 44: HA Kubernetes on Mesos / Marathon

KubernetesReally not so easy to set up as HA

Page 45: HA Kubernetes on Mesos / Marathon

Thank you@planet for the snacks

22seven for the venue

Blue Battleship for the drinks

(^^^ shameless self promotion)