# ks-installer **Repository Path**: ksphere/ks-installer ## Basic Information - **Project Name**: ks-installer - **Description**: No description available - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-12-27 - **Last Updated**: 2025-12-27 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # KSphere 安装器 [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE) [![KSphere](https://img.shields.io/badge/KSphere-v3.0.0-green.svg)](https://ksphere.cn/) [![Kubernetes](https://img.shields.io/badge/Kubernetes-1.15%2B-blue.svg)](https://kubernetes.io/) > 🌩️ KSphere 官方安装器,用于在现有 Kubernetes 集群上快速部署 KSphere > 🇺🇸 [English](README.md) KSphere Installer 是一个基于 Kubernetes Job 和 Ansible 的自动化部署工具,用于在现有 Kubernetes 集群上快速安装和管理 KSphere 平台。支持最小化安装和可插拔组件的灵活配置。 ## ✨ 特性 - 🚀 **快速部署**: 一键部署 KSphere 到现有 Kubernetes 集群 - 🔧 **模块化设计**: 各组件以 Ansible Role 形式独立部署和管理 - 📦 **可插拔组件**: 支持按需启用 DevOps、监控、日志、服务网格等功能 - 🌍 **多集群管理**: 支持单集群、多集群部署模式 - 📊 **企业级功能**: 包含审计、告警、通知等企业级特性 - 🛠️ **自动化运维**: 基于 Shell Operator 和 Ansible 的自动化运维体系 ## 📋 系统要求 ### 前置条件 - **Kubernetes 版本**: 1.15.x, 1.16.x, 1.17.x, 1.18.x 或更高版本 - **资源配置**: CPU > 1 Core, Memory > 2 GB - **存储**: 集群中存在默认的 StorageClass - **网络**: 集群支持 NetworkPolicy (可选) - **CSR**: kube-apiserver 启用了 CSR 签名功能 ### 兼容性说明 - 支持公有云、私有云和本地部署的 Kubernetes 集群 - 兼容主流 CNI 网络插件:Calico、Cilium、Flannel、Weave Net 等 - 支持多种存储提供商:NFS、Ceph、GlusterFS、云存储等 ## 🚀 快速开始 ### 1. 环境检查 验证 Kubernetes 版本: ```bash kubectl version ``` 检查存储配置: ```bash kubectl get sc ``` 检查可用资源: ```bash kubectl top nodes ``` ### 2. 最小化安装 ```bash # 部署安装器 kubectl apply -f https://gitee.com/ksphere/ks-installer/v3.0.0/deploy/ksphere-installer.yaml # 应用集群配置 kubectl apply -f https://gitee.com/ksphere/ks-installer/v3.0.0/deploy/cluster-configuration.yaml # 监控安装进度 kubectl logs -n ksphere-system $(kubectl get pod -n ksphere-system -l app=ks-install -o jsonpath='{.items[0].metadata.name}') -f ``` ### 3. 访问 KSphere 安装完成后,查看控制台服务端口: ```bash kubectl get svc/ks-console -n ksphere-system ``` 使用 `http://<节点IP>:30880` 访问 KSphere 控制台,默认账号:`admin/P@88w0rd` ## ⚙️ 配置选项 ### 核心配置 ClusterConfiguration 支持以下主要配置项: ```yaml spec: persistence: storageClass: "" # 存储类配置 authentication: jwtSecret: "" # JWT 密钥配置 console: enableMultiLogin: true # 多点登录 port: 30880 # 控制台端口 # 可插拔组件配置 alerting: enabled: false # 告警系统 auditing: enabled: false # 审计日志 devops: enabled: false # DevOps 系统 logging: enabled: false # 日志系统 monitoring: enabled: false # 监控系统 servicemesh: enabled: false # 服务网格 multicluster: clusterRole: none # 多集群角色 ``` ### 启用可插拔组件 编辑集群配置: ```bash kubectl edit cc ks-installer -n ksphere-system ``` 或通过 YAML 文件重新应用: ```bash kubectl apply -f cluster-configuration.yaml ``` ## 🏗️ 架构设计 ### 项目结构 ``` ksphere-installer/ ├── deploy/ # 部署清单文件 │ ├── ksphere-installer.yaml # 安装器部署清单 │ └── cluster-configuration.yaml # 集群配置模板 ├── roles/ # Ansible Roles │ ├── ks-core/ # 核心组件 │ │ ├── ks-apiserver/ # API 服务器 │ │ ├── ks-console/ # Web 控制台 │ │ └── ks-controller-manager/ # 控制器 │ ├── ks-logging/ # 日志组件 │ ├── ks-monitoring/ # 监控组件 │ ├── ks-devops/ # DevOps 组件 │ └── ks-istio/ # 服务网格 ├── playbooks/ # Ansible Playbooks ├── controller/ # 控制器脚本 ├── scripts/ # 辅助脚本 └── docs/ # 文档 ``` ### 核心组件 - **Shell Operator**: 基于 Kubernetes 事件驱动的自动化框架 - **Ansible Roles**: 模块化的组件部署和管理 - **ClusterConfiguration**: 声明式的集群配置管理 - **Job Controller**: 基于 Kubernetes Job 的部署控制器 ## 📚 功能组件 ### 核心功能 - **🎯 认证授权**: 基于 JWT 的统一认证体系 - **👥 多租户**: 支持多租户隔离和权限管理 - **🌐 多语言**: 中英文国际化支持 - **📱 响应式**: 现代化的 Web 控制台界面 ### 可选组件 | 组件 | 功能描述 | 资源需求 | |------|----------|----------| | **DevOps** | CI/CD 流水线、Jenkins 集成 | 0.47 Core, 8.6 GB | | **Monitoring** | Prometheus 监控、告警 | 0.3 Core, 300 MB | | **Logging** | Elasticsearch 日志收集 | 57 m, 2.76 GB | | **Service Mesh** | Istio 服务治理 | 0.3 Core, 300 MB | | **Auditing** | 审计日志记录 | 轻量级 | | **Alerting** | 告警策略管理 | 轻量级 | | **Events** | Kubernetes 事件管理 | 轻量级 | | **Multi-cluster** | 多集群管理 | 轻量级 | ## 🔧 高级配置 ### Etcd 监控配置 ```bash # 创建 Etcd 证书 Secret kubectl -n ksphere-monitoring-system create secret generic kube-etcd-client-certs \ --from-file=etcd-client-ca.crt=/etc/kubernetes/pki/etcd/ca.crt \ --from-file=etcd-client.crt=/etc/kubernetes/pki/etcd/healthcheck-client.crt \ --from-file=etcd-client.key=/etc/kubernetes/pki/etcd/healthcheck-client.key ``` ### 存储配置 根据实际需求配置各组件存储大小: ```yaml common: mysqlVolumeSize: 20Gi minioVolumeSize: 20Gi etcdVolumeSize: 20Gi openldapVolumeSize: 2Gi redisVolumSize: 2Gi es: elasticsearchMasterVolumeSize: 4Gi elasticsearchDataVolumeSize: 20Gi ``` ### 网络策略 启用网络策略以增强集群安全性: ```yaml networkpolicy: enabled: true ``` ## 🚨 故障排查 ### 常见问题 1. **安装失败** ```bash # 查看安装日志 kubectl logs -n ksphere-system -l app=ks-install -f # 检查 Pod 状态 kubectl get pods -n ksphere-system ``` 2. **存储问题** ```bash # 检查 StorageClass kubectl get sc # 检查 PVC 状态 kubectl get pvc -n ksphere-system ``` 3. **网络问题** ```bash # 检查服务状态 kubectl get svc -n ksphere-system # 检查 Ingress 状态 kubectl get ingress -n ksphere-system ``` ### 日志收集 ```bash # 收集所有组件日志 kubectl logs -n ksphere-system -l app=ks-install --since=1h > ks-install.log # 收集特定组件日志 kubectl logs -n ksphere-system deployment/ks-console -c ks-console ``` ## 🔄 升级指南 ### 从 v2.1.x 升级到 v3.0.0 1. 备份现有配置: ```bash kubectl get cc ks-installer -n ksphere-system -o yaml > cluster-config-backup.yaml ``` 2. 下载新版本部署文件: ```bash wget https://gitee.com/ksphere/ks-installer/v3.0.0/deploy/ksphere-installer.yaml wget https://gitee.com/ksphere/ks-installer/v3.0.0/deploy/cluster-configuration.yaml ``` 3. 应用新版本: ```bash kubectl apply -f ksphere-installer.yaml kubectl apply -f cluster-configuration.yaml ``` ## 🤝 贡献指南 我们欢迎社区贡献!请阅读 [贡献指南](CONTRIBUTING.md) 了解如何参与项目开发。 ### 开发环境 ```bash # 克隆项目 git clone https://gitee.com/ksphere/ks-installer.git cd ks-installer # 构建镜像 docker build -t kspheredev/ks-installer:latest . # 运行测试 make test ``` ## 📄 许可证 本项目采用 [Apache License 2.0](LICENSE) 开源协议。 ## 🔗 相关链接 - [KSphere 官网](https://ksphere.cn/) - [KSphere 文档](https://ksphere.cn/docs/) - [KSphere GitHub](https://gitee.com/ksphere/ksphere) - [问题反馈](https://gitee.com/ksphere/ks-installer/issues) - [社区论坛](https://ksphere.com.cn/forum/) ## 🙋‍♂️ 获取帮助 - 📖 [官方文档](https://ksphere.cn/docs/) - 💬 [Slack 社区](https://ksphere.slack.com/) - 🐛 [问题追踪](https://gitee.com/ksphere/ks-installer/issues) - 📧 [邮件列表](ksphere@googlegroups.com) --- > ⭐ 如果这个项目对你有帮助,请给我们一个 Star!