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

我們與Kubernetes的距離

Astley Chen
December 12, 2019

 我們與Kubernetes的距離

1. Kubernetes簡介與近況更新
2. 容器部署工具(Helm)簡介
3. K8s如何加速開發流程與服務部署(實戰與案例分享)
4. K8s最佳實踐

Astley Chen

December 12, 2019
Tweet

More Decks by Astley Chen

Other Decks in Technology

Transcript

  1. Who AM I Job Titles: • Software Developer • DevOps/SRE

    Engineer • Cloud Solution Architect • Data Engineer Enthusiasms : • Cloud Native Computing / Docker • Kubernetes / Helm • Service Mesh / Istio • Infrastructure Managing 8 clusters(5 on GKEs, 3 on EKS) more than 80 releases.
  2. 什麼是Kubernetes? • Kubernetes is an open source system for managing

    containerized applications across multiple hosts. • Open-sourced by Google in 2015, donated to CNCF. Kubernetes簡介與近況更新 3/25 1.14.0 6/17 9/18 12/9 1.15.0 1.16.0 1.17.0
  3. Kubernetes的優勢與價值 • Automate containers deploying, scaling, load balancing • Automatic

    rolling updates and rollbacks • Automatically handle networking, storage, logs, alerting • Health check & Self-healing • RBAC advanced security control • Reducing resource costs • Ease-of-use and portability • Outstanding community and industry support ◦ GKE - Google Kubernetes Engine ◦ EKS - AWS Elastic Kubernetes Service ◦ AKS - Azure Kubernetes Service ◦ ... Kubernetes簡介與近況更新
  4. Kubernetes Deployment Kubernetes簡介與近況更新 Deployment: ★ Create ★ Scale ★ Rollout

    ★ Rollback ★ Pause POD Pod: ★ Containers ★ Network ★ Volumes ★ Resources ★ PullSecrets ★ PullPolicy ★ ...
  5. Kubernetes API Resources Kubernetes簡介與近況更新 • WORKLOADS ◦ Container v1 core

    ◦ CronJob v1beta1 batch ◦ DaemonSet v1 apps ◦ Deployment v1 apps ◦ Job v1 batch ◦ Pod v1 core ◦ ReplicaSet v1 apps ◦ ReplicationController v1 core ◦ StatefulSet v1 apps • DISCOVERY & LOAD BALANCING ◦ Endpoints v1 core ◦ Ingress v1beta1 extensions ◦ Service v1 core • CONFIG & STORAGE ◦ ConfigMap v1 core ◦ Secret v1 core ◦ PersistentVolumeClaim v1 core ◦ StorageClass v1 storage.k8s.io ◦ Volume v1 core
  6. Helm • Chart ◦ 定義要被執行的應用程式中,所需要的工具、資源、服務等資訊 • Release ◦ 一個執行於 Kubernetes

    的 Chart 實例 • Repository ◦ 主要用來存放 Chart 的倉庫,如 KubeApps、Bitnami。 ◦ Public repos ▪ stable https://kubernetes-charts.storage.googleapis.com ▪ incubator https://kubernetes-charts-incubator.storage.googleapis.com/ ▪ gitlab https://charts.gitlab.io ▪ bitnami https://charts.bitnami.com Helm is a Kubernetes package and operations manager https://k2r2bai.com/2017/03/25/kubernetes/helm/quick-start/
  7. Helm Components • Helm Client ◦ Client-side CLI ◦ Communicate

    with Tiller Server ◦ Charts release CRUD operations ◦ Charts release version control • Tiller Server ◦ Receive commands from client ◦ Communicate with API-Server ◦ Manage releases and API resources ◦ Removed from Helm v3 (released 11/13) 容器部署工具簡介 https://k2r2bai.com/2017/03/25/kubernetes/helm/quick-start/
  8. Helm • helm create • helm template • helm install/upgrade

    • Helm rollback • helm delete 容器部署工具簡介
  9. 實戰與案例分享 - 推薦引擎 K8s如何加速開發流程與服務部署 [D] Data Source and Data Preparator

    [A] Algorithm [S] Serving [E] Evaluation Metrics http://predictionio.apache.org/customize/
  10. 需求列表 • DevOps ◦ GitLab.com (K8s integration) ◦ Runners for

    CICD tasks • Kubernetes Cluster ◦ Dedicated Node Pools ◦ Pods-Nodes Affinity ◦ Horizontal Pod Autoscaler ◦ Statefulsets Operation ◦ Service Mesh • Workflow Management • Messaging Services • Monitoring and alerting 實戰與案例分享 - 推薦引擎
  11. 需求列表 • Kubernetes Engine ◦ Running all microservices and database

    clusters to fulfill business logic and scenarios. ◦ DevOps & CI/CD by integration with GitLab • PubSub & Cloud Storage ◦ Streaming log and batch data ETL ◦ Blob objects repository for backup and restore. • BigQuery & DataStudio ◦ Data warehouse for streaming log and batch data ◦ Data analytics and presentation • G-Suite & OAuth API ◦ IAM management & apps access control • Stackdriver ◦ Infrastructure & Kubernetes monitoring and alerting 實戰與案例分享 - 推薦引擎
  12. Kubernetes Cluster • Cluster Autoscaler • Node Taints and Pod

    Tolerations • Node Labeling and Node Selector • Node Affinity • Pod Autoscaler 實戰與案例分享 - 推薦引擎
  13. Kubernetes Cluster • Statefulset Operation ◦ Elasticsearch cluster ◦ MongoDB

    Replica Set ◦ MariaDB cluster • Challenges ◦ Upgrade statefulset spec ◦ Upgrade PVC ◦ Update strategies ▪ On Delete ▪ Rolling Updates 實戰與案例分享 - 推薦引擎
  14. K8s最佳實踐 • From Ground Up ( Docker → Docker Compose

    → Helm ) • Configure Liveness, Readiness and Startup Probes Carefully • Configure Resource Requests & Limits Honestly • Service Mesh(Istio) is MUST for Traffic Routing and Tracing • Internal Subsystems Health Probes
  15. K8s最佳實踐 - Bonus #蔡宗城 - 聽說未來不會 K8S 的話,將會被淘汰? ★ Google

    Cloud Platform:US$ 300 頭12個月免費額度,可以使用來 開 GKE ▍連結:https://cloud.google.com/free/ ★ Microsoft Azure:US$ 200 頭12個月免費額度,而且 AKS 有關 AI & ML 的 Workload 是免費的 ▍連結:https://azure.microsoft.com/en-us/free/search/ ★ IBM Cloud:免費提供單一 Worker Node 的 K8S 叢集,對於初學者 來說算是滿夠了 ▍連結:https://www.ibm.com/cloud/free/ ★ Alibaba Cloud:US$ 300 頭12個月免費額度,對於某些特定的 K8S 服務永久免費 ▍連結:https://www.alibabacloud.com/campaign/free-trial ★ Redhat OpenShift:60 天的單一 Worker Node K8S 叢集,可以在 Redhat Account 中取得 ▍連結:https://www.openshift.com/learn/get-started/ ★ Katacoda:把玩 K8S 最常被使用的平台之一,有各種不同類型的 K8S 叢集可以使用,甚至有 minikube 版本 ▍連結:https://www.katacoda.com/courses/kubernetes ★ Tryk8s:提供免費嘗試 K8S 的環境 ▍連結:https://tryk8s.com/ ★ CodeFresh:提供 US$ 500 的免費額度讓使用者嘗試使用 K8S (背 後是利用 GCP 完成) ▍連結:https://codefresh.io/google-cloud/ ★ KubeSail:使用 GitHub 帳號註冊就可以獲得一個免費的 K8S 叢集 ▍連結:https://kubesail.com/deployments https://medium.com/techprimers/free-tiers-in-different-cloud-platforms-for-trying-out-kubernetes-2ccda3f296dc
  16. 參考資料 Kubernetes Basics • https://kubernetes.io/docs/tutorials/kubernetes-basics/ • https://blog.newrelic.com/engineering/what-is-kubernetes/ • http://omerio.com/2015/12/18/learn-the-kubernetes-key-concepts-in-10-minutes/ •

    https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/ Helm Basics • https://k2r2bai.com/2017/03/25/kubernetes/helm/quick-start/