作者 | 平名 阿里服務端開發技術專家
導讀:Kubernetes 作為雲原生時代的“操作系統”,熟悉和使用它是每名用戶的必備技能。本篇文章概述了容器服務 Kubernetes 的知識圖譜,部分內容參考了網上的知識圖譜,旨在幫助用戶更好的了解 K8s 的相關知識。
概述
容器服務 Kubernetes 知識圖譜,部分內容參考網上一知識圖譜,更加結合阿里雲容器服務。
原圖 by 楊傳勝
原圖鏈接地址
https://www.processon.com/view/link/5ac64532e4b00dc8a02f05eb#map
知識鏈接和備注
Docker 原理
- KVM--> ECS
https://blog.csdn.net/weixin_43695104/article/details/88554443#32_kvm_web_192
- 網絡隧道技術-->VPC
https://blog.csdn.net/wangjianno2/article/details/75208036
- NameSpace
https://blog.csdn.net/a352193394/article/details/53344167
備注:Linux 容器中用來實現“隔離”的技術手段:Namespace,Namespace 技術實際上修改了應用進程看待整個計算機的范圍,它的訪問范圍被操作系統做了限制,只能“看到”某些指定的內容。
- CGroup
https://blog.csdn.net/wudongxu/article/details/8474198
備注:Linux Control Group。它最主要的作用,就是限制一個進程組能夠使用的資源上限,包括 CPU、內存、磁盤、網絡帶寬等等。
- RootFS(Union FS)
https://coolshell.cn/articles/17061.html
備注:rootfs 只是一個操作系統所包含的文件、配置和目錄,並不包括操作系統內核。在 Linux 操作系統中,這兩部分是分開存放的,操作系統只有在開機啟動時才會加載指定版本的內核鏡像。
- windows 2019
備注:windowserver 2019開始支持 namespace
容器服務部署
- Docker Desktop
https://www.docker.com/products/docker-desktop
備注:Mac 機器上強烈建議安裝該軟件作為學習使用
- kubernetes
http://docs.kubernetes.org.cn/
備注:kubernetes 集群,aliyun容器服務支持
- DashBoard
https://kubernetes.io/docs/tasks/access-application-cluster/web-ui-dashboard/
備注:kubernetes 集群的圖形界面管理工具,容器服務控制台整合了該應用並擴展
- EasyPack
https://github.com/liumiaocn/easypack
備注:一批部署 kubernetes 等集群的腳本集合
- minikube
https://kubernetes.io/docs/tasks/tools/install-minikube/
備注:mini 新 K8s
工具組件
- kubectl
http://docs.kubernetes.org.cn/61.html備注:kubectl 用於運行 Kubernetes 集群命令的管理工具
- kubeadm
https://kubernetes.io/docs/reference/setup-tools/kubeadm/kubeadm/Kubernetes
備注:官方提供的用於快速安裝配置 Kubernetes 集群的工具
- Helm
備注:類似 rpm,yum,是 K8s 用於安裝組件(軟件包:chart)的工具
- APP Hub
https://developer.aliyun.com/hub
備注:在開放雲原生應用中心當中,所有默認的 Helm Charts(Helm 格式的應用),都定時同步自 Helm Hub 北美官方站並托管在 Github 上。在這個過程中,雲原生應用中心會自動對同步過來的所有 Charts 進行“本地化”操作。
- CFSSL
https://github.com/cloudflare/cfssl
備注:CFSSL 是開源的一款 PKI/TLS 工具,常用於 K8s 證書制作
鏡像倉庫
- aliyun 私有鏡像倉庫
https://cr.console.aliyun.com/aliyun
備注:推出的鏡像倉庫,建議采用企業版
- 雲效配置鏡像倉庫
https://cn.aliyun.com/product/yunxiao
備注:雲效企業設置,配置支持從阿里雲私有鏡像倉庫拉取鏡像
- Harbor 鏡像倉庫
https://goharbor.io
備注:開源免費的存儲和分發Docker鏡像的企業級Registry服務器
組件
- kube-apiserver(Master)
https://kubernetes.io/docs/reference/command-line-tools-reference/kube-apiserver/
備注:在 generic server 上封裝的一層官方默認的 apiserver(static pod)
- etcd(Master)
https://etcd.io
備注:類 zk 基於 Raft 協議的實現,啟動進程
- Kube-scheduler(Master)
https://kubernetes.io/docs/reference/command-line-tools-reference/kube-scheduler/
備注:負責 pod 分布到 Node 上的調度器 (static pod)
- kube-controller-manager(Master)
https://kubernetes.io/docs/reference/command-line-tools-reference/kube-controller-manager/
備注:Deployment 等基礎對象的控制器 (static pod)
- cloud-controller-manager(Master)
https://kubernetes.io/docs/reference/command-line-tools-reference/cloud-controller-manager/
備注:用於雲資源使用的控制器,是雲服務進行集成的控制器 (Daemonset)
- kubelet(Node)
https://kubernetes.io/docs/reference/command-line-tools-reference/kubelet/
備注:與 Master 通信,對 worker(Node) 進行生命周期管理
- kube-proxy(Node)
https://kubernetes.io/docs/reference/command-line-tools-reference/kube-proxy/
備注:節點上運行的網絡代理 (Daemonset)
- containner runtime(Node)
備注:CRI 接口
- DNS
https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/
備注:aliyun容器服務采用 CoreDNS(deployment)
- Ingress controller
https://kubernetes.io/docs/concepts/services-networking/ingress-controllers/
備注:aliyun容器服務采用nginx ingress controller, 可以作為 https 服務的統一路由(deployment)
- Heapster & influxdb
備注:監控數據采集與存儲用的時序數據庫(Deployment)
- Federation
https://kubernetes.io/docs/concepts/cluster-administration/federation/
備注:集群聯盟,實現高可用,同步資源等
- kube-flannel
備注:官方網絡插件,aliyun 另外提供了自己開發的 Terway 組件(daemonset)
- logtail
https://help.aliyun.com/document_detail/28979.html?spm=a2c4g.11186623.6.595.439d7218wQhzsH
備注:aliyun 日志采集組件 (daemonset)
基礎對象
- POD
http://docs.kubernetes.org.cn/312.html 容器組,運行應用容器基本單位,kubectl get pods
- Node
http://docs.kubernetes.org.cn/304.html集群節點服務器,Kubernetes中的工作節點。
- NameSpace
http://docs.kubernetes.org.cn/242.html備注:用以區分和隔離應用
- Deployement
http://docs.kubernetes.org.cn/317.html備注:無狀態部署,最常用部署配置
- Daemonset
https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/
備注:類似守護進程
- StatefulSet
http://docs.kubernetes.org.cn/443.html
備注:有狀態部署
- Job & CronJob
https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/
備注:調度任務
- Static POD
https://kubernetes.io/docs/tasks/configure-pod-container/static-pod/
備注:靜態 pod 配置,yaml 位於 Master
- HPA
https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough/
備注:水平伸縮調度器
- Service
https://kubernetes.io/docs/concepts/services-networking/service/
備注:服務暴露配置,包括 Cluster,NodePort,SLB 等
- Ingress
https://www.kubernetes.org.cn/1885.html
備注:路由,阿里雲默認提供 nginx ingress
- Secret
https://kubernetes.io/docs/concepts/configuration/secret/
備注:保密字典,包括 tls,私有倉庫密鑰,Opaque 幾種
- ServiceAccount
https://kubernetes.io/docs/reference/access-authn-authz/service-accounts-admin/
備注:用於資源對象的賬號,比如給一個 Namespace 授予某私有鏡像訪問權限
- RBAC
https://kubernetes.io/docs/reference/access-authn-authz/rbac/
備注:K8s 基於角色的訪問控制,role,rolebinding
- Volume
https://kubernetes.io/docs/concepts/storage/volumes/
備注:映射磁盤
- Storge Class
https://kubernetes.io/docs/concepts/storage/storage-classes/
- CustomResourceDefinition
備注:自定義擴展資源
插件擴展
- CNI(Falnnel/Terway)
https://kubernetes.io/docs/concepts/extend-kubernetes/compute-storage-net/network-plugins/
備注:容器網絡接口
- FlexVolume
https://github.com/fstab/cifs
備注:開源 Volume 實現插件,阿里雲使用中
- Cloud Provider
備注:雲服務供應接口
容器服務優化-最佳實踐
- Master 選型及磁盤規格
[1] https://yq.aliyun.com/articles/599169?spm=5176.11065265.1996646101.searchclickresult.7bea1a8bgCTYH7
[2] https://yq.aliyun.com/articles/621108?
- 網絡選擇
https://yq.aliyun.com/articles/594943?
- Worker 節點選型
https://yq.aliyun.com/articles/602932?spm=a2c4e
- Ingress Controller 獨立部署
- Master 變配
https://help.aliyun.com/document_detail/123661.html?spm=5176.10695662.1996646101.searchclickresult.20d0328c6WG7jc
- 節點變配或重啟、摘除、加入
- 基礎鏡像開發
- Service 與 SLB 結合
- 集群審計
https://help.aliyun.com/document_detail/91406.html?spm=5176.10695662.1996646101.searchclickresult.45266c92kGHQrP
- Deployment實現分批發布
- StatefulSet 分批發布
https://yq.aliyun.com/articles/622898?spm=a2c4e.11155435.0.0.1b8e3312bSGmSe
- 堡壘機上按照應用設置權限
https://yq.aliyun.com/articles/715809
- Pod 均勻分布部署
https://yq.aliyun.com/articles/715808
- 應用優雅下線,優雅退出
- ApiServer 訪問
- 監控
服務治理
- Istio
https://istio.io
備注:當前最流行的網格服務架構,aliyun 支持
- Linkerd
https://linkerd.io/2/overview/
備注:最早提出網格服務公司的產品
- 雲效
https://www.aliyun.com/product/yunxiao
備注:支持容器服務 K8s 的 CI/CD 阿里雲上產
- Jenkins
https://jenkins.io/zh/
備注:著名的最常用的 CI/CD 產品,容器服務由一鍵安裝產品
雲原生技術公開課
https://edu.aliyun.com/roadmap/cloudnative
備注:阿里雲聯合 CNCF (雲原生計算基金會)共同開發了本套雲原生技術公開課,課程全程免費!
『本文轉載自阿里雲開發者社區』
原文鏈接:
https://developer.aliyun.com/article/715805?utm_content=g_1000073582