Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Dev fest 2020 taiwan how to debug microservices on kubernetes as a pros (https://youtu.be/eseo0hcRaQI?t=11008)

在雲原生時代,基於 Kubernetes 的微服務應用程式架構模式已經快變成基本動作,本議程將介紹如何在 Kubernetes 進行 Debug 來加快開發的速度

Youtube
https://youtu.be/eseo0hcRaQI?t=11008

Related Books

Free with a 30 day trial from Scribd

See all

Related Audiobooks

Free with a 30 day trial from Scribd

See all
  • Be the first to comment

  • Be the first to like this

Dev fest 2020 taiwan how to debug microservices on kubernetes as a pros (https://youtu.be/eseo0hcRaQI?t=11008)

  1. 1. How to debug Microservices on Kubernetes as a pros KAI CHU CHUNG GDGCloud co-organizer GDE(Cloud)
  2. 2. “How to debug Microservices on Kubernetes as a pros”
  3. 3. 1. Debug 2. Microservice 3. Kubernetes Agenda
  4. 4. Debug
  5. 5. 1. Local 2. Container 3. Cloud Debugger Debug
  6. 6. Local (Golang) func main() { http.HandleFunc("/", func(w http.ResponseWriter, req *http.Request) { fmt.Fprintf(w, "hello devfest 2020 tw") }) port := os.Getenv("PORT") if port == "" { port = "8080" log.Printf("Defaulting to port %s", port) } log.Printf("Listening on port %s", port) log.Fatal(http.ListenAndServe(fmt.Sprintf(":%s", port), nil)) }
  7. 7. Local (Python) from flask import Flask app = Flask(__name__) @app.route('/') def index(): return 'hello devfest 2020 tw' if __name__ == '__main__': app.debug = True app.run()
  8. 8. Summary: Local
  9. 9. Containers allow you to package your application and its dependencies together into one succinct manifest What are Containers and their benefits | Google Cloud - https://cloud.google.com/containers
  10. 10. 1. Dockerfile 2. buildpacks Container
  11. 11. Dockerfile (Golang) FROM golang:1.15 AS builder WORKDIR /workspace # Install dependencies in go.mod and go.sum COPY go.mod go.sum ./ RUN go mod download # Copy rest of the application source code COPY . ./ # Compile the application to /app. RUN go build -o /exe -v ./ FROM gcr.io/distroless/base:latest COPY --from=builder /exe . ENTRYPOINT ["/exe"]
  12. 12. Dockerfile (Golang debug) FROM golang:1.15 # Download the dlv (delve) debugger for go RUN go get -u -v github.com/go-delve/delve/cmd/dlv WORKDIR /workspace # Install dependencies in go.mod and go.sum COPY go.mod go.sum ./ RUN go mod download # Copy rest of the application source code COPY . ./ RUN go build -o /exe -v ./ ENTRYPOINT ["dlv", "exec", "/app", "--continue", "--accept-multiclient", "--api-version=2", "--headless", "--listen=:3000", "--log"]
  13. 13. container with known vulnerabilities Source: The state of open source security report 2019 by snyt 44% Google Cloud Next ’20 OnAir - https://cloud.withgoogle.com/next/sf/onair?session=SVR227#application-modernization
  14. 14. 1. CNCF sandbox projects 2. suggest builders a. Google b. Heroku c. Paketo Buildpacks Buildpacks
  15. 15. Buildpacks Go Cloud Native | Heroku - https://blog.heroku.com/buildpacks-go-cloud-native
  16. 16. 1. Open source. 2. Creates secure container images. 3. Designed for running on Cloud Run, GKE, Anthos. Buildpacks GoogleCloudPlatform/buildpacks - https://github.com/GoogleCloudPlatform/buildpacks
  17. 17. ● Google Cloud maintains a set of open source buildpacks for building containers to run on GKE, Anthos, & Cloud Run ● Cloud Build native support for buildpacks ● Cloud Run direct source deployments w/ buildpacks ● Cloud Shell has pack pre-installed. App Engine builds via buildpacks ● Cloud Functions builds via buildpacks ● Cloud Code deploy to Cloud Run with Buildpacks ● Skaffold native support for buildpacks Buildpacks on Google Cloud
  18. 18. pack build aa --builder gcr.io/buildpacks/builder:v1
  19. 19. dive index.docker.io/library/aa:latest wagoodman/dive: A tool for exploring each layer in a docker image - https://github.com/wagoodman/dive
  20. 20. Summary: Container debugger debugger one container one container
  21. 21. Microservice
  22. 22. Microservices refers to an architectural style for developing applications. Microservices allow a large application to be decomposed into independent constituent parts, with each part having its own realm of responsibility
  23. 23. . ├── build ├── cmd ├── deployments ├── internal │ ├── app │ │ ├── authnsvc │ │ ├── authzsvc │ │ ├── docs │ │ ├── emailsvc │ │ ├── invitesvc │ │ ├── mappingsvc │ │ ├── oauthagentsvc │ │ ├── organizationsvc │ │ ├── person_attribute │ │ ├── report_statistics │ │ ├── reportsvc │ │ ├── storesvc │ │ ├── streamsvc │ │ └── ws │ └── pkg ├── pb ├── scripts ├── test ├── cloudbuild-build.yaml ├── cloudbuild-dev-deploy.yaml ├── cloudbuild-dev-meta.yaml ├── cloudbuild-helm.yaml ├── cloudbuild-release-helm.yaml ├── cloudbuild-release-meta.yaml ├── cloudbuild-test.yaml ├── cloudbuild.plantuml ├── makefile └── skaffold.yaml
  24. 24. Service Language Description frontend Go Exposes an HTTP server to serve the website. Does not require signup/login and generates session IDs for all users automatically. cartservice C# Stores the items in the user's shopping cart in Redis and retrieves it. productcatalogservice Go Provides the list of products from a JSON file and ability to search products and get individual products. currencyservice Node.js Converts one money amount to another currency. Uses real values fetched from European Central Bank. It's the highest QPS service. paymentservice Node.js Charges the given credit card info (mock) with the given amount and returns a transaction ID. shippingservice Go Gives shipping cost estimates based on the shopping cart. Ships items to the given address (mock) emailservice Python Sends users an order confirmation email (mock). checkoutservice Go Retrieves user cart, prepares order and orchestrates the payment, shipping and the email notification. recommendationservice Python Recommends other products based on what's given in the cart. adservice Java Provides text ads based on given context words. loadgenerator Python/Locust Continuously sends requests imitating realistic user shopping flows to the frontend. GoogleCloudPlatform/microservices-demo - https://github.com/GoogleCloudPlatform/microservices-demo
  25. 25. Kubernetes
  26. 26. Kubernetes is a portable, extensible, open-source platform for managing containerized workloads and services, that facilitates both declarative configuration and automation. It has a large, rapidly growing ecosystem. Kubernetes services, support, and tools are widely available.
  27. 27. 1 2 3 4 5 6 Change code Run docker build Run docker push Patch yaml Run kubectl apply Verify Kubernetes Development workflow
  28. 28. Skaffold handles the workflow for building, pushing and deploying your application, allowing you to focus on what matters most: writing code
  29. 29. 1. Go (runtime ID: go) 2. NodeJS (runtime ID: nodejs) 3. Java and JVM languages (runtime ID: jvm) 4. Python (runtime ID: python) 5. .NET Core (runtime ID: netcore) Skaffold debug (beta)
  30. 30. Cloud Code comes with tools to help you write, run, and debug cloud-native applications quickly and easily.
  31. 31. Cloud Code | Google Cloud - https://cloud.google.com/code
  32. 32. https://www.facebook.com/groups/GCPUG.TW

    Be the first to comment

在雲原生時代,基於 Kubernetes 的微服務應用程式架構模式已經快變成基本動作,本議程將介紹如何在 Kubernetes 進行 Debug 來加快開發的速度 Youtube https://youtu.be/eseo0hcRaQI?t=11008

Views

Total views

415

On Slideshare

0

From embeds

0

Number of embeds

0

Actions

Downloads

5

Shares

0

Comments

0

Likes

0

×