build applications like google · kubernetes glossary (part 1) master: the managing machine, which...

39
Build applications like Google: Using containers, Kubernetes and Mesos CloudOpen 2014, Düsseldorf Bernd Mathiske, Mesosphere Nat Welch, Google

Upload: others

Post on 19-Jul-2020

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Build applications like Google · Kubernetes glossary (part 1) Master: the managing machine, which oversees one or more minions. Minion: a slave that runs tasks as delegated by the

Build applications like Google: Using containers, Kubernetes and Mesos

CloudOpen 2014, DüsseldorfBernd Mathiske, MesosphereNat Welch, Google

Page 2: Build applications like Google · Kubernetes glossary (part 1) Master: the managing machine, which oversees one or more minions. Minion: a slave that runs tasks as delegated by the
Page 3: Build applications like Google · Kubernetes glossary (part 1) Master: the managing machine, which oversees one or more minions. Minion: a slave that runs tasks as delegated by the

1. Keep programs simple

2. Prefer smaller, stateless programs

Page 4: Build applications like Google · Kubernetes glossary (part 1) Master: the managing machine, which oversees one or more minions. Minion: a slave that runs tasks as delegated by the
Page 5: Build applications like Google · Kubernetes glossary (part 1) Master: the managing machine, which oversees one or more minions. Minion: a slave that runs tasks as delegated by the

Images by Connie Zhou

A 2000-machine cluster will have >10 machine crashes per day

DRAM errors (1% AFR)Disk failures (2-10% AFR)Machine crashes (~2/year)OS upgrades (2-6/year)

Page 6: Build applications like Google · Kubernetes glossary (part 1) Master: the managing machine, which oversees one or more minions. Minion: a slave that runs tasks as delegated by the

Agenda● Hardware => GCE

● Containers => Docker

● Cluster management => Mesos

● Container management => Kubernetes

● Platform stacks for large distributed apps

● How to get started

Page 7: Build applications like Google · Kubernetes glossary (part 1) Master: the managing machine, which oversees one or more minions. Minion: a slave that runs tasks as delegated by the

Google Compute Engine

● VMs as service

● Europe, Asia, US

● Live migration

Page 8: Build applications like Google · Kubernetes glossary (part 1) Master: the managing machine, which oversees one or more minions. Minion: a slave that runs tasks as delegated by the

Problems with raw VMs

● Expensive to turn up (time)

● "Hard" to make repeatable

● Difficult to replicate locally for testing

● High possibility of failure

Page 9: Build applications like Google · Kubernetes glossary (part 1) Master: the managing machine, which oversees one or more minions. Minion: a slave that runs tasks as delegated by the

Container

● Lightweight Linux execution environment○ libcontainer, LXC, LMCTFY

● Static application composition○ Reliable deployment

● Unit of resource isolation○ Multi-tenancy without heavyweight VMs

Page 10: Build applications like Google · Kubernetes glossary (part 1) Master: the managing machine, which oversees one or more minions. Minion: a slave that runs tasks as delegated by the

Docker● Open source

● Configurable layers

● Reproducible

● Version-controlled

● Lots and lots of other peoples containers○ https://registry.hub.docker.com/

Page 11: Build applications like Google · Kubernetes glossary (part 1) Master: the managing machine, which oversees one or more minions. Minion: a slave that runs tasks as delegated by the

Run everything in containers!

Page 12: Build applications like Google · Kubernetes glossary (part 1) Master: the managing machine, which oversees one or more minions. Minion: a slave that runs tasks as delegated by the

Mesos facts● Supports Docker

● Scales to 10,000s of nodes

● Top-level Apache project

● Twitter, Airbnb are major users and contributors

● APIs for C++, Python, JVM-languages, Go, ...

● Pluggable CPU, memory, IO isolation

● Highly configurable, with easy-to-use defaults

● Packages and support through Mesosphere

Page 13: Build applications like Google · Kubernetes glossary (part 1) Master: the managing machine, which oversees one or more minions. Minion: a slave that runs tasks as delegated by the

How Mesos worksApplication

Framework

Mesos Slave

Executor

Task

Task

TaskExecutor

Scheduler

Mesos Master

Mesos MasterMesos

Master

Zookeeper

Mesos Master

Page 14: Build applications like Google · Kubernetes glossary (part 1) Master: the managing machine, which oversees one or more minions. Minion: a slave that runs tasks as delegated by the

Kubernetes● Employs and promotes Docker

● Simple, portable, extensible modular

framework for container-based service

app management

● Patterned after internal systems in Google that

manage internet-scale workloads

● Written in Go

github.com/GoogleCloudPlatform/kubernetes

Page 15: Build applications like Google · Kubernetes glossary (part 1) Master: the managing machine, which oversees one or more minions. Minion: a slave that runs tasks as delegated by the

Kubernetes glossary (part 1)

● Master: the managing machine, which oversees one or more minions.

● Minion: a slave that runs tasks as delegated by the user and Kubernetes master.

● Pod: an application that runs on a minion.

Page 16: Build applications like Google · Kubernetes glossary (part 1) Master: the managing machine, which oversees one or more minions. Minion: a slave that runs tasks as delegated by the

Kubernetes glossary (part 2)● Replication controller: Verifies everything

that should be running is running.● Label: an arbitrary key/value pair that the

Replication Controller uses for service discovery

● kubecfg: the config tool● Service: an amalgamation of similar pods

Page 17: Build applications like Google · Kubernetes glossary (part 1) Master: the managing machine, which oversees one or more minions. Minion: a slave that runs tasks as delegated by the

https://raw.githubusercontent.com/GoogleCloudPlatform/kubernetes/master/docs/architecture.png

Kubernetesoverview

Page 18: Build applications like Google · Kubernetes glossary (part 1) Master: the managing machine, which oversees one or more minions. Minion: a slave that runs tasks as delegated by the

Connection points

● Kubernetes Pod → Mesos TaskGroup● Pod Labels → Mesos TaskGroup Labels, Task Labels● LabelSelectors ↝ Mesos Label Service

● ReplicationController Marathon● Kubernetes Service ↝ Marathon service discovery

Page 19: Build applications like Google · Kubernetes glossary (part 1) Master: the managing machine, which oversees one or more minions. Minion: a slave that runs tasks as delegated by the

Kubernetes-Mesos framework overview

Page 20: Build applications like Google · Kubernetes glossary (part 1) Master: the managing machine, which oversees one or more minions. Minion: a slave that runs tasks as delegated by the

Kubernetes-Mesos master and scheduler

Page 21: Build applications like Google · Kubernetes glossary (part 1) Master: the managing machine, which oversees one or more minions. Minion: a slave that runs tasks as delegated by the

Kubernetes-Mesos executors and tasks

Page 22: Build applications like Google · Kubernetes glossary (part 1) Master: the managing machine, which oversees one or more minions. Minion: a slave that runs tasks as delegated by the

What Mesos contributes● Multi-framework: weighted fair sharing, roles, preemption*, node drain*

● Run pods alongside other popular frameworks

(e.g. Spark, Rails, Hadoop, ...)

● Run services and batch apps in the same cluster

● Advanced scheduling: resources, constraints, global view

● High resource availability, cluster self-healing

● Proven at scale, battle-tested in production

● GUI/CLI cluster management console

(* in development)

Page 23: Build applications like Google · Kubernetes glossary (part 1) Master: the managing machine, which oversees one or more minions. Minion: a slave that runs tasks as delegated by the

What Kubernetes contributes● Pods: tasks to co-locate/deploy/isolate/replicate

● Label Service: arbitrary metadata for tasks/pods

● Tightly integrated service discovery solution

● Ability to run Kubernetes API workloads

Page 24: Build applications like Google · Kubernetes glossary (part 1) Master: the managing machine, which oversees one or more minions. Minion: a slave that runs tasks as delegated by the

+ + +

HardwareFault tolerance

PackagingUpdatesIsolation High availability

Service discoveryService aggregation

ScalabilityElasticity

Multi-tenancyBatch jobsUtilization

Page 25: Build applications like Google · Kubernetes glossary (part 1) Master: the managing machine, which oversees one or more minions. Minion: a slave that runs tasks as delegated by the

Google’s Hardware + Linux

Omega Mesos

Kubernetes

Google-like computing for everybody

Batch

Service Batch Service

GCE

Page 26: Build applications like Google · Kubernetes glossary (part 1) Master: the managing machine, which oversees one or more minions. Minion: a slave that runs tasks as delegated by the

Some possible stack variations

Google’s Hardware + Linux

GCE

Mesos

Marathon

Service

BatchService

Kubernetes

Page 27: Build applications like Google · Kubernetes glossary (part 1) Master: the managing machine, which oversees one or more minions. Minion: a slave that runs tasks as delegated by the

More Possible Stack Variations

Other Hardware or Cloud + Linux or CoreOS

Kubernetes Mesos

Service

Service

Portability => no vendor lock-in

Kubernetes

Mesos

Marathon

Service

Batch

Page 28: Build applications like Google · Kubernetes glossary (part 1) Master: the managing machine, which oversees one or more minions. Minion: a slave that runs tasks as delegated by the

google.mesosphere.com

Page 29: Build applications like Google · Kubernetes glossary (part 1) Master: the managing machine, which oversees one or more minions. Minion: a slave that runs tasks as delegated by the
Page 30: Build applications like Google · Kubernetes glossary (part 1) Master: the managing machine, which oversees one or more minions. Minion: a slave that runs tasks as delegated by the
Page 31: Build applications like Google · Kubernetes glossary (part 1) Master: the managing machine, which oversees one or more minions. Minion: a slave that runs tasks as delegated by the
Page 32: Build applications like Google · Kubernetes glossary (part 1) Master: the managing machine, which oversees one or more minions. Minion: a slave that runs tasks as delegated by the
Page 33: Build applications like Google · Kubernetes glossary (part 1) Master: the managing machine, which oversees one or more minions. Minion: a slave that runs tasks as delegated by the
Page 34: Build applications like Google · Kubernetes glossary (part 1) Master: the managing machine, which oversees one or more minions. Minion: a slave that runs tasks as delegated by the
Page 35: Build applications like Google · Kubernetes glossary (part 1) Master: the managing machine, which oversees one or more minions. Minion: a slave that runs tasks as delegated by the
Page 36: Build applications like Google · Kubernetes glossary (part 1) Master: the managing machine, which oversees one or more minions. Minion: a slave that runs tasks as delegated by the
Page 37: Build applications like Google · Kubernetes glossary (part 1) Master: the managing machine, which oversees one or more minions. Minion: a slave that runs tasks as delegated by the

Summary● Complete stack for large distributed apps

● Multi-tenancy

● Resource optimization

● Easy to deploy

● No vendor lock-in

Page 38: Build applications like Google · Kubernetes glossary (part 1) Master: the managing machine, which oversees one or more minions. Minion: a slave that runs tasks as delegated by the

Useful Links● GCE

○ cloud.google.com/compute

● Kubernetes○ github.com/GoogleCloudPlatform/kubernetes

● Mesosphere○ mesosphere.com

● Kubernetes - Mesos○ github.com/mesosphere/kubernetes-mesos

● Docker○ docker.com