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

在 Cloud Native 中整合 Chatbot 至現有的系統上

在 Cloud Native 中整合 Chatbot 至現有的系統上

在 Cloud Native 中整合 Chatbot 至現有的系統上 - Sam Wang @ COSCUP 2021

Event page: https://coscup.org/2021/zh-TW/session/ED7M9S

LINE Developers Taiwan

August 01, 2021
Tweet

More Decks by LINE Developers Taiwan

Other Decks in Technology

Transcript

  1. 2 Who Am I 王松億 Sam LINE TechFRESH • Graduated

    from NTU IM in 2021/06 • Study master degree in NTU IM • Join LINE TechFRESH program in 2020/07 • Learning Cloud Native and Chatbot
  2. 01 02 03 04 05 06 Contents Introduce Cloud Native

    Introduce Kubernetes Introduce Traefik Cloud Native in ChatBot Demo QA
  3. 4 Cloud Native’s concepts and advantages Introduce Cloud Native •

    Utilizes cloud computing • Build and run scalable applications (containers and microservices) • Resilient • Manageable • Observable • Easier for CI/CD
  4. 5 Cloud Native’s observability Introduce Cloud Native • Distributed tracing,

    logging, monitoring • Observability framework: OpenTelemetry • Visualized dashboard: Grafana
  5. 6 Production-Grade Container Orchestration Introduce Kubernetes > Kubernetes, also known

    as K8s, is an open-source system for automating deployment, scaling, and management of containerized applications. ※Source from:https://kubernetes.io/docs/concepts/overview/what-is-kubernetes/
  6. 7 Production-Grade Container Orchestration Introduce Kubernetes > Kubernetes, also known

    as K8S, is an open-source system for automating deployment, scaling, and management of containerized applications. ※Source from:https://kubernetes.io/docs/concepts/overview/what-is-kubernetes/
  7. Ingress External access to cluster Service Expose an application 8

    Introduce Kubernetes K8S resources Pods Smallest deployable units Deployment Declarative update CronJob Scheduled jobs
  8. 9 K8S’s Ingress Controller Introduce Traefik • Load balance •

    Support multiple middlewares • Support TLS
  9. 10 K8S’s advantages to ChatBot Cloud Native in ChatBot •

    Observability -> trouble shooting • Microservices -> clean architecture • CronJob -> periodically execute scripts
  10. 11 Today’s goal Cloud Native in ChatBot We use K8S

    to build our Chatbot application, Traefik as ingress controller, divide Chatbot app into 5 microservices: 1. Chatbot Webhook 2. Register web frontend 3. Register web backend 4. Users API 5. Cronjob to push messages periodically
  11. 13 Requirements Cloud Native in ChatBot 1. Kubectl + Kustomize

    2. KInD (Kubernetes In Docker) 3. Docker 4. MetalLB Github: https://github.com/disam8853/line-webhook-in-k8s
  12. 14 Step 1: install Traefik Cloud Native in ChatBot 1.

    Follow instruction of official document to apply 1. CRD (Customs Resource Definition) and RBAC (Role-based access control) 2. Trafik’s deployment and service 3. Set service type to `Load Balancer` 2. Install MetalLB if on-premises 3. Install docker-tuntap-osx if using Mac OS in order to connect to docker from host ※Source from:https://www.thehumblelab.com/kind-and-metallb-on-mac/
  13. 15 Step 2: Coding!!! Cloud Native in ChatBot 1. Chatbot

    Webhook webhook 2. Register web frontend register-web-client 3. Register web backend register-web-server 4. Users API api-users 5. Cronjob to push messages periodically (TBD)