Microservices On GCP: How I Learned To Stop Worrying and Learned To Love The Mesh
Microservices On GCP: How I Learned To Stop Worrying and Learned To Love The Mesh
https://github.com/salrashid123
https://medium.com/@salmaan.rashid/
The information, scoping, and pricing data in this presentation is for evaluation/discussion purposes only and is non-binding. For reference purposes,
Google's standard terms and conditions for professional services are located at: https://enterprise.google.com/terms/professional-services.html. © 2018 Google LLC. All rights reserved.
1 Microservices on GCP
s 3 Service Mesh
4 Demo
● Cloud Run
○ Managed; 0->N->0
○ Automatic Auth, IAM
● GKE+Istio
○ Helps with management
● Cloud Functions
○ Managed; 0->N->0
● GKE+Istio+Knative
○ Automatic Auth, IAM ○ Helps even more (too alpha)
● App Engine (original flavor) ● Cloud Services Platform
○ Managed; 0->N->0 ○ All inclusive vacation
○ Automatic Auth ● Provided Services
● GKE ○ Cloud Scheduler (cron)
○ well..GKE is managed ○ Cloud Tasks
○ Your app needs some assembly ○ Pub/Sub
● Container Logs
○ just write to stdout/stderr 😊
○ Write via Logging API 😞*
○ Log grouped by resource type, source
○ gke_cluster, pod, container
● Request->Log correlation
○ "parent->child"
● Logs to Metrics
○ User defined alertable metric derived
from logs
log.Printf("Found ENV lookup backend ip: %v port: %v\n",
backendHost, backendPort)
Monitoring
route=66")
Monitoring + Alerts ● Creating Dashboard with Istio+Stackdriver
● What do you want to monitor? 1. Head over to Stackdriver Monitoring and create a Stackdriver Workspace.
2. Navigate to Dashboards > Create Dashboard in the left sidebar.
● Service Level (Objectives | Indicator| Agreement) 3. In the new Dashboard, click Add Chart and the following metric:
○ SLI: measure metrics for user happiness :) ● Metric: Server Response Latencies
(istio.io/service/server/response_latencies)
○ SLO: SLI + target goal over window ● Group By: destination_workload_name
●
○ ↑ (SLO) →more﹩to operate ●
Aligner: 50th percentile
Reducer: mean
○ SLA: lawyer stuff ● Alignment Period: 1 minute
● Type: Line
○ SRE Fundamentals
● Setup a Dashboard
● Setup Alerts based on Dashboard/SL*
○ PagerDuty,Email, Phone, Slack, etc
● Incident Dashboard to ACK/Resolve/Track
● UptimeChecks:
○ Send HTTP requests to your external IP
○ Check latency, response_code from
datacenters around the world!
Tracing
ctx := span.SpanContext()
tr := ctx.TraceID.String()
lg := client.Logger("spannerlab")
trace := fmt.Sprintf("projects/%s/traces/%s", projectId, tr)
lg.Log(logging.Entry{
Severity: severity,
Payload: fmt.Sprintf(format, v...),
Trace: trace,
SpanID:
ctx.SpanID.String(),
})
Profiling
● Live Heap, CPU, Thread info
● Maintaining resilience, discovery, and routing logic in code for independent services written in different
languages becomes incredibly complex and expensive to operate
● The role of a service mesh is to overlay your services with a management framework
routing/traffic shaping
metrics/logging/tracing
fault injection
Service Service
(Caller) Secure? (Provider)
Version 1.0
Version 2.0
Lookup
Routing Policy Enforcement
Timeout TLS Termination
Circuit Breaker
In Proxy Out In Proxy Out Throttling
Service Service
(Caller) (Provider)
Service proxies intercept outbound and inbound service calls transparent to the service implementation.
The outbound proxy manages routing and error handling strategies, such as retries and circuit breakers.
The inbound proxy validates the service call based on credentials, available quota etc.
Service mesh
conceptual overview
Kubernetes cluster
Pods/Containers
Control plane
Data plane
istio-mixer
Bookinfo Bookinfo
Service Service
Container Container
Data Plane
HipsterShop: http://35.222.251.20/
● Complex, frontend>?->?->?
● Cloud Services Mesh Monitoring
● Cloud Services Mesh Topology
● Tracing
● Monitoring
● Logging
● Turn to page 28
HipsterShop: http://35.222.251.20/
● Sorry, out of stock
● SRE Fundamentals