簡介
大概在 2015,我剛上大學的時候,容器化的概念開始崛起,什麼設定都要手動來,裝 kubernetes 得撞好多 dependency。到了 2017,學會使用 cloudera、rancher 來裝 k8s cluster。而 2024 的現在,建立 kubernetes 毫無難度,一鍵就能安裝完成還不會出錯,甚至出現各種「內建 kubernetes 的作業系統」,而這篇文想使用的 Talos 就是其中一種。
Talos 是一個很有趣的作業系統,他有幾個特性:
- Container OS:內建 kubernetes
- Minimal:作業系統的 ISO 檔不到 100M!除了主要作業系統、kubernetes,沒有其他多餘的工具,資源佔用低
- Secure:精簡的作業系統,攻擊面小
- Immutable OS:root filesystem 唯讀不可變,無法自行寫入和修改,保證系統完整性
- 一個設定檔 (declarative configuration file) 搞定一台機器
- 沒有 ssh 登入,全使用 gRPC API
talosctl來控制機器,就如使用kubectl控制 kubernetes 叢集一樣的概念
當然,特殊用途的作業系統也有些不方便的地方:
- 沒有像是
apt或yum的 package 管理工具。不過官方有 repo 可以安裝,如 iSCSI 驅動、qemu guest 等等 - 學習成本高,不是大眾熟悉的作業系統,要花時間學寫設定檔
這是一個系列文,目錄 在此。
實驗環境
示範環境是 VM,在 Proxmox 8.2、ESXi 6.7 上,作業系統為 macOS,使用 talos 1.7
節點列表
| Name | IP | Role | Hypervisor |
|---|---|---|---|
| control-e01 | 10.2.7.11/23 | Control Plane | Proxmox |
| control-e02 | 10.2.7.12/23 | Control Plane | ESXi |
| control-e03 | 10.2.7.13/23 | Control Plane | Proxmox |
| --- | 10.2.7.15/23 | Control Plane (VIP) | --- |
| worker-e01 | 10.2.7.16/23 | Worker Node | Proxmox |
| worker-e02 | 10.2.7.17/23 | Worker Node | ESXi |
機器規格
最低需求(Minimum):
| Role | Memory | Cores | System Disk |
|---|---|---|---|
| Control Plane | 2 GiB | 2 | 10 GiB |
| Worker | 1 GiB | 1 | 10 GiB |
建議規格(Recommended):
| Role | Memory | Cores | System Disk |
|---|---|---|---|
| Control Plane | 4 GiB | 4 | 100 GiB |
| Worker | 2 GiB | 2 | 100 GiB |
安裝 talosctl
$ curl -sL https://talos.dev/install | sh
# macOS 亦可使用 homebrew 安裝
$ brew install siderolabs/tap/talosctl安裝 kubectl
可參考 kubernetes 官方教學文
下一步,我們來撰寫安裝用設定檔: 我的 Talos 安裝紀錄 (2) - 撰寫設定檔