montreal kubernetes meetup: developer-first workflows (for microservices) on kubernetes

46
Developer-first workflows (for microservices) on Kubernetes Richard Li

Upload: datawire

Post on 21-Jan-2018

306 views

Category:

Software


1 download

TRANSCRIPT

Page 1: Montreal Kubernetes Meetup: Developer-first workflows (for microservices) on Kubernetes

Developer-first workflows (for microservices) on Kubernetes

Richard Li

Page 2: Montreal Kubernetes Meetup: Developer-first workflows (for microservices) on Kubernetes

datawire.io

● Building a cloud application using microservices in 2013

● Distributed systems engineers● Multiple services● Prototyping was really fast

● … then velocity slowed down by a lot when we started getting users and needing to add more features

2

Microservices at Datawire ...

Page 3: Montreal Kubernetes Meetup: Developer-first workflows (for microservices) on Kubernetes

datawire.io

Part 1: How do I gain the benefits of microservices?

(How do I break up my monolith?)(How do I architect my app with microservices?)(What infrastructure do I need in place before I

can benefit from microservices?)

3

Page 4: Montreal Kubernetes Meetup: Developer-first workflows (for microservices) on Kubernetes

datawire.io 4

Stability/Maturity

Velocity

Prototype Production Mission critical

Page 5: Montreal Kubernetes Meetup: Developer-first workflows (for microservices) on Kubernetes

datawire.io 5

Stability/Maturity

Velocity

Prototype Production Mission critical

Page 6: Montreal Kubernetes Meetup: Developer-first workflows (for microservices) on Kubernetes

datawire.io

How do I break up my monolithic architecture?How do I break up my monolithic process into

multiple independent processes?

6

Page 7: Montreal Kubernetes Meetup: Developer-first workflows (for microservices) on Kubernetes

datawire.io 7

Define

Code

Test

Release

Prod

Page 8: Montreal Kubernetes Meetup: Developer-first workflows (for microservices) on Kubernetes

datawire.io 8

Define

Code

Test

Release

Prod

Centralized process

● Specialized teams● Fixed policies (e.g.,

release criteria)

Page 9: Montreal Kubernetes Meetup: Developer-first workflows (for microservices) on Kubernetes

datawire.io 9

Microservices lets you run multiple processes!

Page 10: Montreal Kubernetes Meetup: Developer-first workflows (for microservices) on Kubernetes

datawire.io 10

Industrial Revolution.

Page 11: Montreal Kubernetes Meetup: Developer-first workflows (for microservices) on Kubernetes

datawire.io

Microservices is a distributed development architecture

workflow.

11

Page 12: Montreal Kubernetes Meetup: Developer-first workflows (for microservices) on Kubernetes

datawire.io 12

Stability/Maturity

Velocity

Prototype Production Mission critical

● How do I get to Continuous Deployment incrementally?● How do I limit the scope of PCI (audit process)?● How do I ship feature X as fast as possible?

Page 13: Montreal Kubernetes Meetup: Developer-first workflows (for microservices) on Kubernetes

datawire.io

Microservices is ...

● Multiple workflows○ Including your existing workflow!○ Workflows designed for different

stability/velocity tradeoffs● Simultaneous workflows

13

Page 14: Montreal Kubernetes Meetup: Developer-first workflows (for microservices) on Kubernetes

datawire.io

Doing things this way shifts how people operate!

● Specialists become generalists → design better holistic systems● Dev vs Ops vs QA → roadmap / API conversations● Challenging for engineers → More fun!

14

Page 15: Montreal Kubernetes Meetup: Developer-first workflows (for microservices) on Kubernetes

datawire.io

Part 2: How do I create multiple, simultaneous workflows?

15

Page 16: Montreal Kubernetes Meetup: Developer-first workflows (for microservices) on Kubernetes

datawire.io

Create self-sufficient, autonomous software teams.

16

Page 17: Montreal Kubernetes Meetup: Developer-first workflows (for microservices) on Kubernetes

datawire.io

Why self-sufficiency and autonomy?

● Self-sufficient○ Team does not need to rely on other teams to achieve its goals

● Autonomy○ Team is able to independently make (process) decisions on how to achieve its goals

17

Page 18: Montreal Kubernetes Meetup: Developer-first workflows (for microservices) on Kubernetes

datawire.io

Centralized specialist functions are a common barrier to self-sufficiency and autonomy

18

Centralized architectureCentralized infrastructure / ops*

(You might need a platform team, eventually)

Page 19: Montreal Kubernetes Meetup: Developer-first workflows (for microservices) on Kubernetes

datawire.io 19

Page 20: Montreal Kubernetes Meetup: Developer-first workflows (for microservices) on Kubernetes

datawire.io 20

Monolith

Page 21: Montreal Kubernetes Meetup: Developer-first workflows (for microservices) on Kubernetes

datawire.io 21

Monolith

(soon-to-be) self-sufficient, autonomous team

Page 22: Montreal Kubernetes Meetup: Developer-first workflows (for microservices) on Kubernetes

datawire.io

I’m stranded on API island. Do I have to build my workflow from scratch?

22

Page 23: Montreal Kubernetes Meetup: Developer-first workflows (for microservices) on Kubernetes

datawire.io

No! Kubernetes / Docker / Envoy give you the infra you need

23

Page 24: Montreal Kubernetes Meetup: Developer-first workflows (for microservices) on Kubernetes

datawire.io

Docker

● A consistent build/runtime for your service

● Run locally or in Kubernetes cluster● Massive community & ecosystem

○ 14M Docker hosts○ 3300+ contributors○ Lots of third party tools

24

Page 25: Montreal Kubernetes Meetup: Developer-first workflows (for microservices) on Kubernetes

datawire.io

Kubernetes

● Cloud POSIX● Declarative definition of your cloud

infrastructure

● Supported by all major vendors: Google, Microsoft, Mesos, Docker, Oracle, Red Hat, IBM all support it

● … except for Amazon.○ Yet 62% of K8S workloads on AWS

25

Page 26: Montreal Kubernetes Meetup: Developer-first workflows (for microservices) on Kubernetes

datawire.io

Envoy

● Modern L7 proxy, designed for cloud applications○ Resilience: global rate-limiting, circuit

breakers○ APIs for managing fleets of Envoys○ L7 observability (incl distributed tracing)

● Fast growing ecosystem & community○ Maintained by Lyft○ Google, IBM, Apple, Datawire, Verizon○ CNCF project

26

Page 27: Montreal Kubernetes Meetup: Developer-first workflows (for microservices) on Kubernetes

datawire.io

Cloud Native Compute Foundation

27

● Istio● SPIFFE● App dev

Page 28: Montreal Kubernetes Meetup: Developer-first workflows (for microservices) on Kubernetes

datawire.io

Summary

1. Microservices is a distributed workflow: multiple & simultaneous processes.2. Start building your distributed workflow by creating a self-sufficient, autonomous

team.3. Kubernetes / Docker / Envoy give you the basic operational primitives you need.

28

Page 29: Montreal Kubernetes Meetup: Developer-first workflows (for microservices) on Kubernetes

datawire.io

Part 3: How do I actually use these technologies to build my workflow?

29

Page 30: Montreal Kubernetes Meetup: Developer-first workflows (for microservices) on Kubernetes

datawire.io 30

Monolith

Prototype new feature, FAST

Page 31: Montreal Kubernetes Meetup: Developer-first workflows (for microservices) on Kubernetes

datawire.io 31

Stage 1: Prototyping

Existing workflow: Designed for mature app, not prototyping

Challenge: Prototyping workflow that is fast but not one-off

Strategies:● Dev infra ~= Prod infra● Self-service operational

infrastructure

Page 32: Montreal Kubernetes Meetup: Developer-first workflows (for microservices) on Kubernetes

datawire.io

Strategy: Dev infrastructure ~= Prod infrastructure

32

● End-to-end○ Have developers access the service the same way as end users (e.g., through an

API Gateway, ingress, etc.)

● Environmental consistency○ Insure that your dev runtime is the same as your initial production runtime○ Environmental differences between dev & prod will cause bugs. So eliminate

them upfront.

Your dev infrastructure should resemble your production infrastructure as much as possible.

Page 33: Montreal Kubernetes Meetup: Developer-first workflows (for microservices) on Kubernetes

datawire.io

Strategy: Self-service operational infrastructure

33

Infrastructure needs to be configured by the service team, not by operations (otherwise, there’s a bottleneck.)

Service team needs to be able to publish new services, without operations.

Service team has access to the Kubernetes manifest (maybe they use a standard template).

Page 34: Montreal Kubernetes Meetup: Developer-first workflows (for microservices) on Kubernetes

datawire.io

Implementing Stage 1 strategies

● Eliminate environmental differences○ Containerize your service and use the same container for dev & prod○ Template your Kubernetes manifests so you can use the same manifest for dev & prod

● End-to-end○ Use an API Gateway for dev and prod (you can even use the same one)

● Self-service operational infrastructure○ Expose the right configuration options, in a rational way, for your infrastructure to the service

team■ Kubernetes manifest■ Configuring your API Gateway

34

Page 35: Montreal Kubernetes Meetup: Developer-first workflows (for microservices) on Kubernetes

datawire.io 35

Monolith

Now in production, and need to ITERATE

Page 36: Montreal Kubernetes Meetup: Developer-first workflows (for microservices) on Kubernetes

datawire.io 36

Stage 2: Production users

Existing workflow: App-level integration testing & roll out; dedicated QA team; unit tests

Challenge: Update service quickly, while not letting bugs impact the end user

Strategies:● Software redundancy

Page 37: Montreal Kubernetes Meetup: Developer-first workflows (for microservices) on Kubernetes

datawire.io

Strategy: Multiple versions for software redundancy

37

End user

Primary version

Canary version

Dev version

Page 38: Montreal Kubernetes Meetup: Developer-first workflows (for microservices) on Kubernetes

datawire.io 38

Stage 3 Internal service consumption

Existing workflow: None

Challenge: Communicate to consumers the service contract, and support that contract in the service

Strategy:● Service level objectives● Network-level observability &

resilience

Page 39: Montreal Kubernetes Meetup: Developer-first workflows (for microservices) on Kubernetes

datawire.io

● Define the target level of your service as part of your API● Common SLOs relate to throughput, latency, and availability

○ This API will support up to 5,000 requests per second per consumer○ The expected latency at p50, p90, p99

● Simple implementation of SLOs can be via monitoring

Strategy: Service level objectives

39

Page 40: Montreal Kubernetes Meetup: Developer-first workflows (for microservices) on Kubernetes

datawire.io

Strategy: Network level observability & resilience

● Observability○ Figure out which service is causing the problem○ Need visibility at a network level○ Distributed tracing (e.g., Jaeger, Zipkin)

● Resilience○ Avoid cascade failure○ Network-level rate limiting, circuit breaking, etc.

● Service mesh○ Strategy for implementing network-level observability & resilience that’s transparent to end users○ Istio just proposed to the CNCF

40

Page 41: Montreal Kubernetes Meetup: Developer-first workflows (for microservices) on Kubernetes

datawire.io

Summary

1. Microservices is a distributed workflow.2. Start building your distributed workflow by creating a self-sufficient, autonomous

team.3. Kubernetes / Docker / Envoy give you the basic operational primitives you need. 4. Your workflow requirements depend on your service maturity (prototype,

production, internal dependencies).5. Strategies for building your workflow

a. Prototype: Dev ~= Prod, self-service operational infrastructureb. Production: Software redundancyc. Internal dependencies: Service level objectives, network-level observability/resilience

41

Page 42: Montreal Kubernetes Meetup: Developer-first workflows (for microservices) on Kubernetes

datawire.io

So how does this work in practice?

42

Page 43: Montreal Kubernetes Meetup: Developer-first workflows (for microservices) on Kubernetes

datawire.io

Your traditional monolith workflow ...

● Intended for iterative improvement & prevent downtime○ Code locally in dev environment○ Pull request○ Branch for release○ QA branch & integration test on staging environment○ Release on production environment

● Different environments, specialized teams

43

Page 44: Montreal Kubernetes Meetup: Developer-first workflows (for microservices) on Kubernetes

datawire.io

Versus microservice infrastructure & workflow ...

● Eliminate environmental differences○ Container -- same run time environment○ Kubernetes -- same deployment environment

● Self-service operational infrastructure○ Templated Kubernetes manifest○ Self-service API Gateway

● Multiple versions for software redundancy○ Facilitated by API Gateway / router

44

Will let you prototype / launch / update a microservice with a workflow that’s tailored to feature development.

Page 45: Montreal Kubernetes Meetup: Developer-first workflows (for microservices) on Kubernetes

datawire.io

Thank you!

[email protected]● Getting ready to launch hands-on tutorials on building your own distributed

workflow. If you’re interested in being notified, sign up here:○ https://d6e.co/montrealk8s

● If you’re interested in any of our open source tools, check them out:○ https://forge.sh for deployment○ https://www.telepresence.io for real-time live coding○ https://www.getambassador.io self-service API Gateway built on Envoy

45

Page 46: Montreal Kubernetes Meetup: Developer-first workflows (for microservices) on Kubernetes

END