53
@saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes Debugging & Troubleshooting Microservices w/ Kubernetes It runs in production, or is it?

Debugging & Troubleshooting Microservices It runs in ... · @saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes Debugging & Troubleshooting Microservices w/ Kubernetes

  • Upload
    others

  • View
    10

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Debugging & Troubleshooting Microservices It runs in ... · @saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes Debugging & Troubleshooting Microservices w/ Kubernetes

@saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes

Debugging & Troubleshooting Microservicesw/ Kubernetes

It runs in production, or is it?

Page 2: Debugging & Troubleshooting Microservices It runs in ... · @saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes Debugging & Troubleshooting Microservices w/ Kubernetes

@saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes

Ray TsangDeveloper AdvocateGoogle Cloud Platform

Java Champion

Spring Cloud GCPcloud.spring.io/spring-cloud-gcp/

JHipster, JDeferred

@saturnism

Page 3: Debugging & Troubleshooting Microservices It runs in ... · @saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes Debugging & Troubleshooting Microservices w/ Kubernetes

@saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes

BaruchSadogurskyDeveloper AdvocateJFrog

@jbaruch

Page 4: Debugging & Troubleshooting Microservices It runs in ... · @saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes Debugging & Troubleshooting Microservices w/ Kubernetes

@saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes

Shownotes!

● jfrog.com/shownotes○ Slides○ Video (tomorrow)○ Links○ Feedback○ Raffle

Page 5: Debugging & Troubleshooting Microservices It runs in ... · @saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes Debugging & Troubleshooting Microservices w/ Kubernetes

@saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes

Page 6: Debugging & Troubleshooting Microservices It runs in ... · @saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes Debugging & Troubleshooting Microservices w/ Kubernetes

@saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes

Hello World Service - Greet

Guestbook Service - Create

Guestbook Service - Retrieve

Page 7: Debugging & Troubleshooting Microservices It runs in ... · @saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes Debugging & Troubleshooting Microservices w/ Kubernetes

@saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes

GuestbookUI

Hello World Service

Redis

session replication

greeting

MySQL

GuestbookService

CRUD

Page 8: Debugging & Troubleshooting Microservices It runs in ... · @saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes Debugging & Troubleshooting Microservices w/ Kubernetes

@saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes

Let's see it!

Page 9: Debugging & Troubleshooting Microservices It runs in ... · @saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes Debugging & Troubleshooting Microservices w/ Kubernetes

@saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes

2015 - FAIL! 14:01

Page 10: Debugging & Troubleshooting Microservices It runs in ... · @saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes Debugging & Troubleshooting Microservices w/ Kubernetes

@saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes

2016 - FAIL! 1:49:50

Page 11: Debugging & Troubleshooting Microservices It runs in ... · @saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes Debugging & Troubleshooting Microservices w/ Kubernetes

@saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes

2017 - FAIL! 31:00

Page 12: Debugging & Troubleshooting Microservices It runs in ... · @saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes Debugging & Troubleshooting Microservices w/ Kubernetes

@saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes

2018 - FAIL! 2:28:47

Page 13: Debugging & Troubleshooting Microservices It runs in ... · @saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes Debugging & Troubleshooting Microservices w/ Kubernetes

@saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes

Visibility & Insight is Key

Page 14: Debugging & Troubleshooting Microservices It runs in ... · @saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes Debugging & Troubleshooting Microservices w/ Kubernetes

@saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes

Repository metadata - key insight into artifacts and their relationships

Page 15: Debugging & Troubleshooting Microservices It runs in ... · @saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes Debugging & Troubleshooting Microservices w/ Kubernetes

@saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes

Production vs Non-Production :(

Page 16: Debugging & Troubleshooting Microservices It runs in ... · @saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes Debugging & Troubleshooting Microservices w/ Kubernetes

@saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes

Distributed Systems are hard!

Page 17: Debugging & Troubleshooting Microservices It runs in ... · @saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes Debugging & Troubleshooting Microservices w/ Kubernetes

@saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes

We've been there, done that

Page 18: Debugging & Troubleshooting Microservices It runs in ... · @saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes Debugging & Troubleshooting Microservices w/ Kubernetes

@saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes

Information - Logs!

kubectl logs -f pod_id

Page 19: Debugging & Troubleshooting Microservices It runs in ... · @saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes Debugging & Troubleshooting Microservices w/ Kubernetes

@saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes

Inspecting the process / container

kubectl exec -ti pod_id /bin/bash

Page 20: Debugging & Troubleshooting Microservices It runs in ... · @saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes Debugging & Troubleshooting Microservices w/ Kubernetes

@saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes

Port forward to container

kubectl port-forward pod_id local_port:remote_port

Page 21: Debugging & Troubleshooting Microservices It runs in ... · @saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes Debugging & Troubleshooting Microservices w/ Kubernetes

@saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes

Isolate problematic instance w/ Labels

kubectl label pod pod_id --overewrite serving=false

Page 22: Debugging & Troubleshooting Microservices It runs in ... · @saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes Debugging & Troubleshooting Microservices w/ Kubernetes

@saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes

Pod

frontend

Pod

serving = true

version = 1.0

Pod

serving = true

version = 1.0

Service

Label selectors: version = 1.0 serving = true

Pod

serving = true

version = 1.0

Page 23: Debugging & Troubleshooting Microservices It runs in ... · @saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes Debugging & Troubleshooting Microservices w/ Kubernetes

@saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes

Pod

frontend

Pod

serving = true

version = 1.0

Pod

serving = true

version = 1.0

Service

Label selectors: version = 1.0 serving = true

Pod

serving = false

version = 1.0

Page 24: Debugging & Troubleshooting Microservices It runs in ... · @saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes Debugging & Troubleshooting Microservices w/ Kubernetes

@saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes

Log aggregation, at scale

Page 25: Debugging & Troubleshooting Microservices It runs in ... · @saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes Debugging & Troubleshooting Microservices w/ Kubernetes

@saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes

Stackdriver Logginghttps://cloud.google.com/logging/

Page 26: Debugging & Troubleshooting Microservices It runs in ... · @saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes Debugging & Troubleshooting Microservices w/ Kubernetes

@saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes

Page 27: Debugging & Troubleshooting Microservices It runs in ... · @saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes Debugging & Troubleshooting Microservices w/ Kubernetes

@saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes

Metrics from Logs → Alerting

Near-realtime insight

Page 28: Debugging & Troubleshooting Microservices It runs in ... · @saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes Debugging & Troubleshooting Microservices w/ Kubernetes

@saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes

Search and Query Your Logs

Page 29: Debugging & Troubleshooting Microservices It runs in ... · @saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes Debugging & Troubleshooting Microservices w/ Kubernetes

@saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes

Export to BigQuery, Storage, Pub/Sub

Near-realtime insight

Page 30: Debugging & Troubleshooting Microservices It runs in ... · @saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes Debugging & Troubleshooting Microservices w/ Kubernetes

@saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes

Page 31: Debugging & Troubleshooting Microservices It runs in ... · @saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes Debugging & Troubleshooting Microservices w/ Kubernetes

@saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes

Page 32: Debugging & Troubleshooting Microservices It runs in ... · @saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes Debugging & Troubleshooting Microservices w/ Kubernetes

@saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes

Tracing at Google - Dapperhttps://research.google.com/pubs/pub36356.html

Page 33: Debugging & Troubleshooting Microservices It runs in ... · @saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes Debugging & Troubleshooting Microservices w/ Kubernetes

@saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes

Zipkin

Page 34: Debugging & Troubleshooting Microservices It runs in ... · @saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes Debugging & Troubleshooting Microservices w/ Kubernetes

@saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes

Stackdriver Tracehttps://cloud.google.com/trace/

Page 35: Debugging & Troubleshooting Microservices It runs in ... · @saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes Debugging & Troubleshooting Microservices w/ Kubernetes

@saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes

Zipkin → Stackdriver Tracehttps://cloud.google.com/trace/docs/zipkin

Page 36: Debugging & Troubleshooting Microservices It runs in ... · @saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes Debugging & Troubleshooting Microservices w/ Kubernetes

@saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes

Page 37: Debugging & Troubleshooting Microservices It runs in ... · @saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes Debugging & Troubleshooting Microservices w/ Kubernetes

@saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes

Page 38: Debugging & Troubleshooting Microservices It runs in ... · @saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes Debugging & Troubleshooting Microservices w/ Kubernetes

@saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes

Page 39: Debugging & Troubleshooting Microservices It runs in ... · @saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes Debugging & Troubleshooting Microservices w/ Kubernetes

@saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes

Page 40: Debugging & Troubleshooting Microservices It runs in ... · @saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes Debugging & Troubleshooting Microservices w/ Kubernetes

@saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes

Automatic reports

Detect performance regression

Page 41: Debugging & Troubleshooting Microservices It runs in ... · @saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes Debugging & Troubleshooting Microservices w/ Kubernetes

@saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes

Oops… I forgot a log message. Darn!

Page 42: Debugging & Troubleshooting Microservices It runs in ... · @saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes Debugging & Troubleshooting Microservices w/ Kubernetes

@saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes

Don't you wish you can use a debugger?

Page 43: Debugging & Troubleshooting Microservices It runs in ... · @saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes Debugging & Troubleshooting Microservices w/ Kubernetes

@saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes

Stackdriver Debugger - Production Debugger

https://cloud.google.com/debugger/

Page 44: Debugging & Troubleshooting Microservices It runs in ... · @saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes Debugging & Troubleshooting Microservices w/ Kubernetes

@saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes

Add debugger agent

java -agentpath:/opt/cdbg/cdbg_java_agent.so ... -jar PATH_TO_JAR_FILE

Page 45: Debugging & Troubleshooting Microservices It runs in ... · @saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes Debugging & Troubleshooting Microservices w/ Kubernetes

@saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes

Logpoint - dynamically add log messages!

No redeployment, Magic.

gcloud debug logpoints create HelloworldService.java:35 \"Received endpoint: {endpoint}/{name}" --target helloworld-ui-1.0-SNAPSHOT

Page 46: Debugging & Troubleshooting Microservices It runs in ... · @saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes Debugging & Troubleshooting Microservices w/ Kubernetes

@saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes

Snapshots

Inspect call stack and variables

Page 47: Debugging & Troubleshooting Microservices It runs in ... · @saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes Debugging & Troubleshooting Microservices w/ Kubernetes

@saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes

Page 48: Debugging & Troubleshooting Microservices It runs in ... · @saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes Debugging & Troubleshooting Microservices w/ Kubernetes

@saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes

Page 49: Debugging & Troubleshooting Microservices It runs in ... · @saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes Debugging & Troubleshooting Microservices w/ Kubernetes

@saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes

Trace

Log

Debug

Page 50: Debugging & Troubleshooting Microservices It runs in ... · @saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes Debugging & Troubleshooting Microservices w/ Kubernetes

@saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes

Trace → Stackdriver Trace

Logs → Stackdriver Logging

Debug → Stackdriver Debuggerhttps://cloud.google.com/stackdriver/

Page 51: Debugging & Troubleshooting Microservices It runs in ... · @saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes Debugging & Troubleshooting Microservices w/ Kubernetes

@saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes

Thanks!Source: https://github.com/saturnism/spring-boot-dockerShownotes: https://jfrog.com/shownotesStackdriver: https://cloud.google.com/stackdriver/

Ray Tsang@saturnismGoogle Cloud Platform

Baruch Sadogursky@jbaruchJFrog

Page 52: Debugging & Troubleshooting Microservices It runs in ... · @saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes Debugging & Troubleshooting Microservices w/ Kubernetes

@saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes

Page 53: Debugging & Troubleshooting Microservices It runs in ... · @saturnism @jbaruch @jfrog @gcpcloud #devoxxua jfrog.com/shownotes Debugging & Troubleshooting Microservices w/ Kubernetes

@saturnism @jbaruch @jfrog @googlecloud #devoxxFR jfrog.com/shownotes