Upgrade to Pro — share decks privately, control downloads, hide ads and more …

通往Cloud Native的神奇之旅: 自製 Kubernetes 工具大揭秘

通往Cloud Native的神奇之旅: 自製 Kubernetes 工具大揭秘

Speaker: Luther Tsai - LINE Pay Taiwan Server Development Team
Event: iThome Kubernetes Summit

LINE Developers Taiwan

October 25, 2023
Tweet

More Decks by LINE Developers Taiwan

Other Decks in Technology

Transcript

  1. 01 02 03 04 Flow Decision & Tech Stack Self-Implemented

    Tool Outcome & Improvement Pain Points 05 Summary AGENDA
  2. 01 02 03 04 Flow Decision & Tech Stack Self-Implemented

    Tool Outcome & Improvement Pain Points 05 Summary AGENDA Why How What Which
  3. LINE Pay Services Payment Service Financial Service Points Service Promotion

    Service Partner Service Donation Service Merchant Service
  4. Legacy applications running on VM Application Scale out / in

    Self-Healing Blue Green Deployment Server Preparation Pain Points
  5. Legacy applications running on VM Application Scale out / in

    Self-Healing Blue Green Deployment Server Preparation Pain Points
  6. Legacy applications running on VM Application Scale out / in

    Self-Healing Blue Green Deployment Server Preparation Pain Points
  7. Legacy applications running on VM Application Scale out / in

    Self-Healing Blue Green Deployment Server Preparation Pain Points
  8. What do we have? Comply with Regulation Pioneer Application Current

    CI/CD Inspection How do we start? Disaster Recovery
  9. Which kind of resource that we could use What we've

    got on the table? 2020 2021 2022 2023 App Integration HARBOR
  10. Pros & Cons • Infra Team support & Gradually support

    with Verda Resource integration • In 2020, the latest version on Verda VKS is v1.15 • We could choose the resources that we need by our own • Managed all infra layer by our own
  11. • Infra Team support & Gradually support with Verda Resource

    integration • In 2020, the latest version on Verda VKS is v1.15 • We could choose the resources that we need by our own • Managed all infra layer by our own Both of them are baremetal version of Kubernetes. Not like GKE or EKS on AWS. They both need installation on related resources. (eg. Ingress Controller) Pros & Cons
  12. What do we have? Comply with Regulation Pioneer Application Current

    CI/CD Inspection How do we start? Disaster Recovery
  13. AS-IS CI/CD flow Developer Trigger deployment Build excutable files by

    branch Deploy to target runtime servers VMs Trigger Build Upload excutable files Code Push
  14. What do we have? Comply with Regulation Pioneer Application Current

    CI/CD Inspection How do we start? Disaster Recovery
  15. AS-IS CI/CD flow Developer Trigger deployment Build excutable files by

    branch Deploy to target runtime servers VMs Trigger Build Upload excutable files Code Push Centralize CI/CD flow control with regulation compliance RESTRICTED ZONE
  16. TO-BE CI/CD flow Developer Trigger deployment Build docker image by

    branch Proxy Agent Trigger Build Upload deploy script & version tag Code Push Pull runtime image Push runtime image Manipulate Cluster
  17. TO-BE CI/CD flow Developer Trigger deployment Build docker image by

    branch Proxy Agent Trigger Build Code Push 1. Run deploy script 2. Generate YAML 3. Apply on our cluster
  18. RESTRICTED ZONE TO-BE CI/CD flow Developer Trigger deployment Build docker

    image by branch Proxy Agent Trigger Build Code Push
  19. What do we have? Comply with Regulation Pioneer Application Current

    CI/CD Inspection How do we start? Disaster Recovery
  20. Disaster Recovery (AS-IS) Developer Trigger deployment Build excutable files by

    branch Deploy to target runtime servers VMs Trigger Build Upload excutable files Code Push
  21. Disaster Recovery (AS-IS) Developer Trigger deployment Build excutable files by

    branch Replacement VMs Trigger Build Upload excutable files Code Push Re-run the deployment jobs (RESUME)
  22. Disaster Recovery (AS-IS) Developer Trigger deployment Build excutable files by

    branch Replacement VMs Trigger Build Upload excutable files Code Push Takes lot of times & different requirements on each applications Re-run the deployment jobs (RESUME)
  23. Disaster Recovery (TO-BE) Developer Trigger deployment Build docker image by

    branch Proxy Agent Trigger Build Code Push 1. Setup the cluster with preserved installation YAML 2. Setup the Proxy Agent Config 3. Re-run the deployment jobs (RESUME)
  24. What do we have? Comply with Regulation Pioneer Application Current

    CI/CD Inspection How do we start? Disaster Recovery
  25. Designed CI/CD flow Developer Trigger deployment Build docker image by

    branch Proxy Agent Trigger Build Code Push 1. Run deploy script 2. Generate YAML 3. Apply on our cluster
  26. How we made our own deployment integration? First Try –

    Customize target project with following mechanism Deployment YAML template Build docker image script App deploy script – Generate YAML & Apply YAML Tool for creating ConfigMap YAML
  27. How we made our own deployment integration? First Try -

    Making our own ConfigMap YAML generator with python
  28. How we made our own deployment integration? First Try –

    Write our own deploy script with the tool above 1. Generating ConfigMap YAML 2. Replace the YAML template with each environment & deployment version 3. Print output YAML on each run 4. Apply YAML to cluster
  29. How we made our own deployment integration? First Try Proxy

    Agent Generate Deployment YAML Apply Deployment YAML Upload by nDeploy
  30. How we made our own deployment integration? First Try Generate

    Deployment YAML Apply Deployment YAML Upload by nDeploy Is it suitable for our team? Proxy Agent
  31. How we made our own deployment integration? First Try Proxy

    Agent Generate Deployment YAML Apply Deployment YAML Upload by nDeploy Raw use on k8s resource YAML Highly Customized by each project / application
  32. How we made our own deployment integration? First Try Proxy

    Agent Generate Deployment YAML Apply Deployment YAML Upload by nDeploy Raw use on k8s resource YAML Highly Customized by each project / application
  33. How we made our own deployment integration? Optimized – Build

    our own CLI tool Pay CLI 1. Fetch shared YAML template by project type 2. Generate Deployment YAML 3. Apply Deployment YAML 5. Send deployment notification 4. Store generated YAMLs for app for manifests archive
  34. How we made our own deployment integration? Optimized – Build

    our own CLI tool REMOVED Build docker image script (NO CHANGED) Run command of generating YAML & Run deploy command REMOVED
  35. Run deployment with our own CLI tool Integrate k8s deployment

    easily Upgrade Cluster without downtime Ability to migrate to another cluster Centralized k8s resources Outcome Blue Green Deployment
  36. vUser (process/thread) TPS Peak TPS Successful Response Error Response Fail

    Rate VM 300 (10/30) 47 89 7716 832 9.7 % Kubernetes 62.9 79 10190 0 0 % Kubernetes with HPA (auto-scale 1 -> 3) 126 193 20437 3 0.1 % Kubernetes with HPA (Pre-scale 1 -> 3) 173.2 202 28411 0 0 % Performance Test One of our campaign page (server-side rendering) ※ Test on our BETA env with same CPU/MEM resources 33% Improvement 37% Improvement
  37. HPA helps solving the peak issue Pod statistic on Grafana

    Request statistic on log system Scale out automatically
  38. LB Gateway Server Gateway Application Gateway Application Web Server LB

    API Server Application A Application B Application C Web Static files Dedicate Server with Resource Reserved Hard to scale with request dynamically Which we’ve changed Legacy VM System Infrastructure Web Application
  39. LB Gateway Server Gateway Application Gateway Application Web Server LB

    Which we’ve changed Cluster Based System Infrastructure nodepool A nodepool B nodepool C Ingress Controller