llm-wiki wiki · sources 2026-06-14

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

一句话定位

Kubespray 用 Ansible inventory/roles 部署生产可用 Kubernetes 集群,覆盖 kubeadm、network plugin、etcd、HA 和云/裸金属差异。

核心架构图

┌────────────────────────────────────────────────────────────────────────────┐
│ Cluster deployment inventory                                               │
│ Hosts, variables, networking, runtime, and add-ons define desired cluster  │
│ shape.                                                                     │
└────────────────────────────────────────────────────────────────────────────┘
                                       │
                                       ▼
┌────────────────────────────────────────────────────────────────────────────┐
│ Kubespray Ansible playbooks                                                │
│ Roles prepare OS, container runtime, kubeadm, control plane, workers, and  │
│ CNI.                                                                       │
└────────────────────────────────────────────────────────────────────────────┘
                                       │
                                       ▼
┌────────────────────────────────────────────────────────────────────────────┐
│ Lifecycle operations                                                       │
│ Install, upgrade, scale, reset, and configure production Kubernetes        │
│ clusters.                                                                  │
└────────────────────────────────────────────────────────────────────────────┘
                                       │
                                       ▼
┌────────────────────────────────────────────────────────────────────────────┐
│ Output                                                                     │
│ Bare-metal, VM, or cloud Kubernetes clusters managed through repeatable    │
│ automation.                                                                │
└────────────────────────────────────────────────────────────────────────────┘

模块分层

层 / 模块 职责
Inventory hosts/group_vars/cluster config
Ansible roles kubeadm/etcd/network/storage/addons
Playbooks cluster.yml/upgrade/reset
Provider support bare metal/cloud/on-prem

关键数据流

用户准备 inventory
        │
        ▼
Ansible 配置 OS/runtime/etcd
        │
        ▼
kubeadm 初始化 control plane
        │
        ▼
加入 worker nodes
        │
        ▼
安装 CNI/addons 并验证

设计决策与哲学