雲原生及容器基本概念
雲原生
技術範疇
1 雲應用定義與開發流程:應用定義與鏡像制作、配置 CI/CD、消息和 Streaming 以及資料庫
2 應用的編排與管理流程:應用編排與排程、服務發現治理、遠端調用、API 網關以及 Service Mesh
3 監控與可觀測性:雲上應用如何進行監控、日志收集、Tracing 以及在雲上如何實作破壞性測試,也就是混沌工程的概念
4 雲原生的底層技術:容器運作時、雲原生存儲技術、雲原生網絡技術
5 雲原生工具集:流程自動化與配置管理、容器鏡像倉庫、雲原生安全技術以及雲端密碼管理
6 Serverless
理論基礎
1 不可變基礎設施
2 雲應用編排理論
基礎設施向雲演進的過程
雲時代的基礎設施就像是可以替代的“牲口”,可以随時替換
雲演進的意義
基礎設施的一緻性和可靠性
鏡像本身就是自包含的,其包含了應用運作所需要的所有依賴,是以也可以漂移到雲上的任何一個位置
關鍵技術點
1 如何建構自包含、可定制的應用鏡像
2 能不能實作應用快速部署與隔離能力
3 應用基礎設施建立和銷毀的自動化管理
4 可複制的管控系統和支撐元件
定義
1 雲原生為使用者指定了一條低心智負擔的、靈活的、能夠以可擴充、可複制的方式最大化地利用雲的能力、發揮雲的價值的最佳路徑
2 指導進行軟體架構設計的思想
3 認為未來的軟體,會從誕生起就生長在雲上,并且遵循一種新的軟體開發、釋出和運維模式,進而使得軟體能夠最大化地發揮雲的能力
容器
容器就是一個視圖隔離、資源可限制、獨立檔案系統的程序集合
隔離及控制技術
1 namespace
2 cgroup-限制其資源使用率
3 檔案系統-chroot
4 鏡像- changeset 每個建構步驟都會對已有的檔案系統進行操作,這樣就會帶來檔案系統内容的變化,我們将這些變化稱之為 changeset
5 當 initial 程序退出的時候,所有的子程序也會随之退出
資料卷管理
1 bind 的方式:因為其依賴于主控端的目錄,需要對于所有的主控端進行統一管理
2 Volume:engine 管理
moby 容器引擎架構
1 moby daemon
2 containerd
3 (containerd)-shim
4 守護程序
插件化管理新container 技術-runC/kata/gVisor
1 隔離,可以實作moby,containerd 動态更新
2 container
3 runC/kata/gVisor
docker run 關鍵指令參數
1 The UTS namespace :setting the hostname and the domain that is visible to running processes in that namespace. By default, all containers, including those with --network=host, have their own UTS namespace. The host setting will result in the container using the same UTS namespace as the host. Note that --hostname and --domainname are invalid in host UTS mode.
2 --ipc=“MODE” : Set the IPC mode for the container ,”” Use daemon’s default.
2.1 “none” Own private IPC namespace, with /dev/shm not mounted.
2.2 “private” Own private IPC namespace.
2.3 “shareable” Own private IPC namespace, with a possibility to share it with other containers.
2.4 “container: <name-or-ID>" Join another (“shareable”) container’s IPC namespace.
2.5 “host” Use the host system’s IPC namespace.
3 --pid="" : Set the PID (Process) Namespace mode for the container,
‘container:<name|id>’: joins another container’s PID namespace
‘host’: use the host’s PID namespace inside the container