Craig Box - Managing Your Microservices With Kubernetes and Istio
Craig Box - Managing Your Microservices With Kubernetes and Istio
2
What is a service mesh?
A network for services, not bytes
● Traffic Control
● Visibility
● Resiliency & Efficiency
● Security
● Policy Enforcement
Remember the monolith?
Monolithic App
Module Module
File System
Database
Module Module
Microservices
Service
Service
Database
File System
5
Success!
Gained development velocity!
Easy testing because of abstractions!
Scale services independently!
6
At what cost?
● Replaced a reliable in-process call with
an unreliable RPC.
● Secure in-process communication is
replaced by insecure network.
● Access control within process was a
no-op
● Latency went up
● Trivial single-stepping replaced by … ?
7
Can we fix it?
● Add retry logic to the application code
● Add entry-exit traces
● Secure inter-service connections with
strong authentication
8
While we're adding code...
Choose the RPC endpoint intelligently
9
Service mesh
Istio
A complete framework for
connecting, securing, managing
and monitoring services
12
Kubernetes provides service abstraction
web web
auth auth
payments payments
logging logging
13
Weaving the mesh
Users
frontend auth Cloud SQL
External
Payment
pictures payments Processor
14
Weaving the mesh
proxy proxy
ingress
proxy proxy
External
Payment
pictures payments Processor
15
The sidecar proxy: Envoy
● A C++ based L4/L7 proxy
● Low memory footprint
● Battle-tested @ Lyft
○ 100+ services
○ 10,000+ VMs
○ 2M req/s
● An awesome team willing to work with the
community!
16
The sidecar proxy: Envoy
Goodies:
● HTTP/2 & gRPC
● Zone-aware load balancing w/ failover
● Health checks, circuit breakers, timeouts, retry budgets
● No hot reloads - API driven config updates
Istio's contributions
● Transparent proxying w/ SO_ORIGINAL_DST
● Traffic routing and splitting
● Request tracing using Zipkin
● Fault injection
17
Injection
spec: spec:
containers: containers:
- image: frontend:latest - image: frontend:latest
- image: istio/proxy
frontend frontend
proxy
Initializer policy
initImage: docker.io/istio/proxy_init
proxyImage: docker.io/istio/proxy
18
Architecture
frontend payments
Traffic transparently proxied —
unaware of Envoy sidecars
proxy proxy
Policy checks,
Discovery & config telemetry TLS certs
data to Envoy sidecars to Envoy sidecars
Control Plane
19
● Traffic Control
● Visibility
● Resiliency & Efficiency
● Security
● Policy Enforcement
Application rollout
// A simple traffic splitting rule
destination: pictures.example.local frontend
match:
source: frontend.example.local proxy
route:
- tags: 99% 1%
version: v1.5
env: prod pictures
weight: 99
- tags: proxy proxy
version: v2.0-alpha
env: staging pictures pictures
weight: 1
- tags:
version: 2.0-alpha proxy proxy
env: staging
pictures pictures
Goals:
● Metrics without instrumenting apps
● Consistent metrics across fleet
● Trace flow of requests across services
● Portable across metric backend
providers
24
Metrics flow
frontend pictures
Custom
Prometheus
InfluxDB
runtime
27
Tracing
frontend pictures
calls
Zipkin
Custom
Stackdriver
● Envoys send traces to Mixer
○ Adapters at Mixer send traces to
respective backends
28
● Traffic Control
● Visibility
● Resiliency & Efficiency
● Security
● Policy Enforcement
Resiliency
// Circuit breakers
destination: auth.cluster.local
policy:
- tags:
version: v1
circuitBreaker:
simpleCb:
httpConsecutiveErrors: 7
sleepWindow: 5m
httpDetectionInterval: 1m
30
Resiliency features
● Timeouts
● Retries with timeout budget
● Circuit breakers
● Health checks
● AZ-aware load balancing w/ automatic failover
● Control connection pool size and request load
● Systematic fault injection
31
Resiliency testing
Systematic fault injection to identify weaknesses in failure
recovery policies
● HTTP/gRPC error codes
● Delay injection
300ms 400ms
33
● Traffic Control
● Visibility
● Resiliency & Efficiency
● Security
● Policy Enforcement
Security
● Verifiable identity
● Secure naming / addressing
● Traffic encryption
● Revocation
35
Security at scale
frontend payments
Envoy Envoy
Istio-Auth
36
● Traffic Control
● Visibility
● Resiliency & Efficiency
● Security
● Policy Enforcement
What does Mixer do?
● Check()
○ Precondition checking
○ Quotas & Rate Limiting
● Report()
○ telemetry reporting
● Primary point of extensibility
● Enabler for platform mobility
● Operator-focused configuration model
38
Putting it all together
frontend payments
proxy proxy
Policy checks,
Discovery & config telemetry TLS certs
data to Envoy sidecars to Envoy sidecars
Control Plane
39
Ultimately, it's just this
Users
frontend auth Cloud SQL
External
Payment
pictures payments Processor
40
Getting started
● Install Kubernetes (v1.7+ for Initializers)
○ Google Container Engine Alpha clusters
● istio.io quickstart
● Helm chart
○ helm install incubator/istio
● Bookinfo service example
41
Roadmap
● 0.1: a single Kubernetes namespace
● 0.2 (just launched): a single Kubernetes
cluster and external VMs
● 0.3 (by end of year): production readiness
within a single cluster
● 1.0: (2018): complete mesh across all
environments
Release roadmap
42
Thank you
Craig Box
43