building a microservices platform with kubernetes · microservices running inside containers on top...

60
Building a Microservices Platform with Kubernetes Matthew Mark Miller @DataMiller

Upload: others

Post on 20-May-2020

10 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Building a Microservices Platform with Kubernetes · Microservices running inside Containers on top of Platforms on any infrastructure. ... Clouds operate because of workload orchestration

Building a Microservices Platform with Kubernetes

Matthew Mark Miller@DataMiller

Page 2: Building a Microservices Platform with Kubernetes · Microservices running inside Containers on top of Platforms on any infrastructure. ... Clouds operate because of workload orchestration

Cloud Native:Microservices running insideContainers on top of Platforms on any infrastructure

Page 3: Building a Microservices Platform with Kubernetes · Microservices running inside Containers on top of Platforms on any infrastructure. ... Clouds operate because of workload orchestration

Microservice

A software component of a system that is independently releasable and independently scalable from other parts of the system.

Page 4: Building a Microservices Platform with Kubernetes · Microservices running inside Containers on top of Platforms on any infrastructure. ... Clouds operate because of workload orchestration

Container

A software process whose access has been reduced to the point that it thinks it is the only thing running.

Page 5: Building a Microservices Platform with Kubernetes · Microservices running inside Containers on top of Platforms on any infrastructure. ... Clouds operate because of workload orchestration

Platform

The parts of your service that you don't build yourself.

Page 6: Building a Microservices Platform with Kubernetes · Microservices running inside Containers on top of Platforms on any infrastructure. ... Clouds operate because of workload orchestration

But wait...aren’t we supposed to be Full Stack?!

Page 7: Building a Microservices Platform with Kubernetes · Microservices running inside Containers on top of Platforms on any infrastructure. ... Clouds operate because of workload orchestration
Page 8: Building a Microservices Platform with Kubernetes · Microservices running inside Containers on top of Platforms on any infrastructure. ... Clouds operate because of workload orchestration
Page 9: Building a Microservices Platform with Kubernetes · Microservices running inside Containers on top of Platforms on any infrastructure. ... Clouds operate because of workload orchestration

A platform’s responsibility is to make implicit the link between a service and

the resource it consumes.

Page 10: Building a Microservices Platform with Kubernetes · Microservices running inside Containers on top of Platforms on any infrastructure. ... Clouds operate because of workload orchestration
Page 11: Building a Microservices Platform with Kubernetes · Microservices running inside Containers on top of Platforms on any infrastructure. ... Clouds operate because of workload orchestration
Page 12: Building a Microservices Platform with Kubernetes · Microservices running inside Containers on top of Platforms on any infrastructure. ... Clouds operate because of workload orchestration

Clouds operate because of workload orchestration

Page 13: Building a Microservices Platform with Kubernetes · Microservices running inside Containers on top of Platforms on any infrastructure. ... Clouds operate because of workload orchestration

Don’t roll your own orchestration.

Page 14: Building a Microservices Platform with Kubernetes · Microservices running inside Containers on top of Platforms on any infrastructure. ... Clouds operate because of workload orchestration

Integrating workloads requires tinkering at runtimeToken swapping

Modifications to the host container’s configuration

Swapping in binaries

Page 15: Building a Microservices Platform with Kubernetes · Microservices running inside Containers on top of Platforms on any infrastructure. ... Clouds operate because of workload orchestration

Integrating this way isn’t easyTakes time & testing to get it right

What you built and tested isn’t necessarily what runs in production.

Leads to providers offering fewer, more highly opinionated stacks

Page 16: Building a Microservices Platform with Kubernetes · Microservices running inside Containers on top of Platforms on any infrastructure. ... Clouds operate because of workload orchestration

A big question for platform engineers:

How can we spend more time building useful services and less time maintaining the platform?

Page 17: Building a Microservices Platform with Kubernetes · Microservices running inside Containers on top of Platforms on any infrastructure. ... Clouds operate because of workload orchestration
Page 18: Building a Microservices Platform with Kubernetes · Microservices running inside Containers on top of Platforms on any infrastructure. ... Clouds operate because of workload orchestration
Page 19: Building a Microservices Platform with Kubernetes · Microservices running inside Containers on top of Platforms on any infrastructure. ... Clouds operate because of workload orchestration

KubernetesBorg meets Docker; Resistance is futile

Page 20: Building a Microservices Platform with Kubernetes · Microservices running inside Containers on top of Platforms on any infrastructure. ... Clouds operate because of workload orchestration
Page 21: Building a Microservices Platform with Kubernetes · Microservices running inside Containers on top of Platforms on any infrastructure. ... Clouds operate because of workload orchestration

(Obligatory architecture slide)

Page 22: Building a Microservices Platform with Kubernetes · Microservices running inside Containers on top of Platforms on any infrastructure. ... Clouds operate because of workload orchestration
Page 23: Building a Microservices Platform with Kubernetes · Microservices running inside Containers on top of Platforms on any infrastructure. ... Clouds operate because of workload orchestration
Page 24: Building a Microservices Platform with Kubernetes · Microservices running inside Containers on top of Platforms on any infrastructure. ... Clouds operate because of workload orchestration
Page 25: Building a Microservices Platform with Kubernetes · Microservices running inside Containers on top of Platforms on any infrastructure. ... Clouds operate because of workload orchestration
Page 26: Building a Microservices Platform with Kubernetes · Microservices running inside Containers on top of Platforms on any infrastructure. ... Clouds operate because of workload orchestration

Kubernetes is popular, open and growing

Page 27: Building a Microservices Platform with Kubernetes · Microservices running inside Containers on top of Platforms on any infrastructure. ... Clouds operate because of workload orchestration

To those of us building platforms, Kubernetes offersReliable cluster & workload management

A stack agnostic hosting abstraction (Docker)

Battle-tested fundamental abstractions that give rise to powerful deployment patterns

Page 28: Building a Microservices Platform with Kubernetes · Microservices running inside Containers on top of Platforms on any infrastructure. ... Clouds operate because of workload orchestration

Kubernetes Fundamentals

Page 29: Building a Microservices Platform with Kubernetes · Microservices running inside Containers on top of Platforms on any infrastructure. ... Clouds operate because of workload orchestration

ControllersLoops that maintain state

Run continuously on Master

Each Kubernetes object gets its own Controller

Controllers are pluggable & lightweight

Rely on declarative manifests to determine intent

Page 30: Building a Microservices Platform with Kubernetes · Microservices running inside Containers on top of Platforms on any infrastructure. ... Clouds operate because of workload orchestration

The PodMany containers, working together as a single unit

Shared IP & localhost

Shared filesystem

Scale together

Separate hardware limits

Can be tagged with a label, providing scheduling advice

Page 31: Building a Microservices Platform with Kubernetes · Microservices running inside Containers on top of Platforms on any infrastructure. ... Clouds operate because of workload orchestration

ServicesPermanent, logical addresses for internal servicesExpose a name, port and stable IP for a group of pods

Load balance between individual pods

Provided to pods via DNS or environment variable

Constructed using a selector onto pod labels (sort of like a database query)

Page 32: Building a Microservices Platform with Kubernetes · Microservices running inside Containers on top of Platforms on any infrastructure. ... Clouds operate because of workload orchestration

NetworkingRules for all Kubernetes installationsEach Pod gets its own unique IP address (which is the same outside and in)

All Pods must be able to communicate with each other without NAT

All Pods must be able to communicate with and participate in Services

Page 33: Building a Microservices Platform with Kubernetes · Microservices running inside Containers on top of Platforms on any infrastructure. ... Clouds operate because of workload orchestration

IngressSimplifies Layer 7 access to Kubernetes servicesWorks with load balancers, including cloud load balancers & nginx

Presents a single root URL mapping to multiple services

Publicly expose private networks

Terminates TLS/SSL

Page 34: Building a Microservices Platform with Kubernetes · Microservices running inside Containers on top of Platforms on any infrastructure. ... Clouds operate because of workload orchestration

Using the fundamentals to build a platform

Pod patterns from Burns & Oppenheimer, USENIX 2016

Page 35: Building a Microservices Platform with Kubernetes · Microservices running inside Containers on top of Platforms on any infrastructure. ... Clouds operate because of workload orchestration

How can my platform provide availability during workload releases?

Page 36: Building a Microservices Platform with Kubernetes · Microservices running inside Containers on top of Platforms on any infrastructure. ... Clouds operate because of workload orchestration

Rolling Deployments

Page 37: Building a Microservices Platform with Kubernetes · Microservices running inside Containers on top of Platforms on any infrastructure. ... Clouds operate because of workload orchestration

Rolling Deployments

Page 38: Building a Microservices Platform with Kubernetes · Microservices running inside Containers on top of Platforms on any infrastructure. ... Clouds operate because of workload orchestration

Rolling Deployments

Page 39: Building a Microservices Platform with Kubernetes · Microservices running inside Containers on top of Platforms on any infrastructure. ... Clouds operate because of workload orchestration

Rolling Deployments

Page 40: Building a Microservices Platform with Kubernetes · Microservices running inside Containers on top of Platforms on any infrastructure. ... Clouds operate because of workload orchestration

How can my platform non-destructively add functionality to a workload?

Page 41: Building a Microservices Platform with Kubernetes · Microservices running inside Containers on top of Platforms on any infrastructure. ... Clouds operate because of workload orchestration

Sidecars

Page 42: Building a Microservices Platform with Kubernetes · Microservices running inside Containers on top of Platforms on any infrastructure. ... Clouds operate because of workload orchestration

How can my platform insulate workloads from complexity and state of services?

Page 43: Building a Microservices Platform with Kubernetes · Microservices running inside Containers on top of Platforms on any infrastructure. ... Clouds operate because of workload orchestration

Ambassador

Page 44: Building a Microservices Platform with Kubernetes · Microservices running inside Containers on top of Platforms on any infrastructure. ... Clouds operate because of workload orchestration

How can my platform communicate with a workload when I want a different

protocol than it was built with?

Page 45: Building a Microservices Platform with Kubernetes · Microservices running inside Containers on top of Platforms on any infrastructure. ... Clouds operate because of workload orchestration

Adapter

Page 46: Building a Microservices Platform with Kubernetes · Microservices running inside Containers on top of Platforms on any infrastructure. ... Clouds operate because of workload orchestration

How can my platform provide “singleton” behaviors in a scaled-out service?

Page 47: Building a Microservices Platform with Kubernetes · Microservices running inside Containers on top of Platforms on any infrastructure. ... Clouds operate because of workload orchestration

Leader Elector

Page 48: Building a Microservices Platform with Kubernetes · Microservices running inside Containers on top of Platforms on any infrastructure. ... Clouds operate because of workload orchestration

How can my platform provide “work queue” behavior without altering a

workload?

Page 49: Building a Microservices Platform with Kubernetes · Microservices running inside Containers on top of Platforms on any infrastructure. ... Clouds operate because of workload orchestration

Work Queue

Page 50: Building a Microservices Platform with Kubernetes · Microservices running inside Containers on top of Platforms on any infrastructure. ... Clouds operate because of workload orchestration

Kubernetes Tweet Bait“Could this be POSIX of distributed systems?!”

Page 51: Building a Microservices Platform with Kubernetes · Microservices running inside Containers on top of Platforms on any infrastructure. ... Clouds operate because of workload orchestration

How does it all come together?

Page 52: Building a Microservices Platform with Kubernetes · Microservices running inside Containers on top of Platforms on any infrastructure. ... Clouds operate because of workload orchestration

Scalewhale: A troubled serviceThe output we want… … but we get overloaded

Page 53: Building a Microservices Platform with Kubernetes · Microservices running inside Containers on top of Platforms on any infrastructure. ... Clouds operate because of workload orchestration

Initial rollout

Page 54: Building a Microservices Platform with Kubernetes · Microservices running inside Containers on top of Platforms on any infrastructure. ... Clouds operate because of workload orchestration

Brute force scale-out

Page 55: Building a Microservices Platform with Kubernetes · Microservices running inside Containers on top of Platforms on any infrastructure. ... Clouds operate because of workload orchestration

Metric-driven Autoscale

Page 56: Building a Microservices Platform with Kubernetes · Microservices running inside Containers on top of Platforms on any infrastructure. ... Clouds operate because of workload orchestration

Swap in a work queue!

Page 57: Building a Microservices Platform with Kubernetes · Microservices running inside Containers on top of Platforms on any infrastructure. ... Clouds operate because of workload orchestration

Questions

Page 58: Building a Microservices Platform with Kubernetes · Microservices running inside Containers on top of Platforms on any infrastructure. ... Clouds operate because of workload orchestration

Get hip to the heptagonA platform is a real developer advantage but must avoid reinvention and being overly proscriptive.

Kubernetes was built to bring independence from hardware choices.

Kubernetes also brings separation of concerns to dev teams.

It’s built from simple rules and objects that improve the usefulness and portability of containers.

Page 59: Building a Microservices Platform with Kubernetes · Microservices running inside Containers on top of Platforms on any infrastructure. ... Clouds operate because of workload orchestration

Slides available athttps://is.gd/k8splatform

Page 60: Building a Microservices Platform with Kubernetes · Microservices running inside Containers on top of Platforms on any infrastructure. ... Clouds operate because of workload orchestration

Bibliography“Design Patterns for Container-base Distributed Systems” -- Burns, Oppenheimer USENIX 2016

“Site Reliability Engineering” -- Beyer, Jones, Petoff, Murphy. O’Reilly 2016

“From Google to the World: The Kubernetes Origin Story” -- McLuckie, 2016