llm-wiki wiki · sources 2026-06-14

原文:raw/cluster-api-architecture-analysis.md · 仓库:https://github.com/kubernetes-sigs/cluster-api · 优先级 P0

一句话定位

Cluster API 用声明式 API 管理 Kubernetes 集群生命周期,把 Cluster/Machine/MachineDeployment 和 provider infra/bootstrap/control-plane 拆成可组合控制器。

核心架构图

┌────────────────────────────────────────────────────────────────────────────┐
│ Declarative cluster lifecycle intent                                       │
│ Platform teams describe desired workload clusters and machines.            │
└────────────────────────────────────────────────────────────────────────────┘
                                       │
                                       ▼
┌────────────────────────────────────────────────────────────────────────────┐
│ Cluster API core                                                           │
│ Cluster, Machine, MachineDeployment, MachineSet, and related lifecycle     │
│ controllers.                                                               │
└────────────────────────────────────────────────────────────────────────────┘
                                       │
                                       ▼
┌────────────────────────────────────────────────────────────────────────────┐
│ Provider contracts                                                         │
│ Infrastructure, bootstrap, and control-plane providers implement           │
│ environment details.                                                       │
└────────────────────────────────────────────────────────────────────────────┘
                                       │
                                       ▼
┌────────────────────────────────────────────────────────────────────────────┐
│ Output                                                                     │
│ A management cluster continuously reconciles workload clusters and         │
│ machines.                                                                  │
└────────────────────────────────────────────────────────────────────────────┘

模块分层

层 / 模块 职责
Core API Cluster, Machine, MachineDeployment, MachineSet
Providers infrastructure/bootstrap/control-plane
Controllers reconcile desired cluster state
Clusterctl provider init/move/upgrade workflow

关键数据流

用户声明 Cluster/Machine topology
        │
        ▼
CAPI core controller 协调对象
        │
        ▼
provider controller 创建云/裸金属资源
        │
        ▼
bootstrap/control-plane provider 初始化节点
        │
        ▼
状态回写并支持升级/迁移

设计决策与哲学