Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Build applications like Google

Build applications like Google

Using containers, Kubernetes and Mesos
GoSF 2014

Patrick Reilly

October 23, 2014
Tweet

More Decks by Patrick Reilly

Other Decks in Programming

Transcript

  1. Build applications like Google: Using containers, Kubernetes and Mesos GoSF

    2014, San Francisco Patrick Reilly, Mesosphere @preillyme
  2. • [TBD] • More than a Sandbox, Less than a

    VM • Lightweight Linux environment • Hermetically sealed, deployable system • Introspectable, runnable artifact • Recently popularized by Docker What is a container?
  3. Static application environment = reliable deployments No stress deployment and

    update care? Repeatable, runnable artifact = portability Develop here, run there Pick your cloud solely on its merits Loosely coupled = easier to build and manage Compose applications from micro- services Mix in and extend third party services Why should developers care?
  4. 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)
  5. Agenda • Hardware => GCE • Containers => Docker •

    Cluster management => Mesos • Container management => Kubernetes • Platform stacks for large distributed apps • How to get started
  6. Problems with raw VMs • Expensive to turn up (time)

    • "Hard" to make repeatable • Difficult to replicate locally for testing • High possibility of failure
  7. Container • Lightweight Linux execution environment ◦ libcontainer, LXC, LMCTFY

    • Static application composition ◦ Reliable deployment • Unit of resource isolation ◦ Multi-tenancy without heavyweight VMs
  8. Docker • Open source • Configurable layers • Reproducible •

    Version-controlled • Lots and lots of other peoples containers ◦ https://registry.hub.docker.com/
  9. 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
  10. How Mesos works Application Framework Mesos Slave Executor Task Task

    Task Executor Scheduler Mesos Master Mesos Master Mesos Master Zookeeper Mesos Master
  11. 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
  12. Kubernetes Client API Server K-M Scheduler Replication Controller Mesos Master

    Replicated Log Mesos Slave Mesos Slave Mesos Slave K-M Executor Kubelet Pod Proxy Container A Container B DockerD
  13. 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.
  14. 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
  15. Connection points • Kubernetes Pod → Mesos TaskGroup • Pod

    Labels → Mesos TaskGroup Labels, Task Labels • LabelSelectors ↝ Mesos Label Service • ReplicationController Marathon • Kubernetes Service ↝ Marathon service discovery
  16. 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)
  17. 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
  18. + + + Hardware Fault tolerance Packaging Updates Isolation High

    availability Service discovery Service aggregation Scalability Elasticity Multi-tenancy Batch jobs Utilization
  19. 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
  20. Summary • Complete stack for large distributed apps • Multi-tenancy

    • Resource optimization • Easy to deploy • No vendor lock-in
  21. 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