SuperAPI AI 工具集

flux-gitops

部署与运维

查看项目

更新于 10-15 22:38

技能介绍

用途:该技能描述 homelab Kubernetes 平台如何使用 Flux ResourceSet 对 Helm 发布与配置进行集中、声明式管理,适用于向平台新增 Helm 发布或应用、管理版本与依赖、排查 Flux 同步问题。

主要能力:新增 Helm 发布的标准流程为:在 helm-charts.yaml 的 inputs 中登记条目,创建 charts/<release-name>.yaml 值文件,在 kustomization.yaml 的 configMapGenerator 中注册,必要时添加 config/<name>/ 资源。inputs 条目包含 name、namespace、chart(name、version、url)与 dependsOn;OCI 仓库的 url 以 oci:// 前缀,ResourceSet 模板会自动识别并设置 HelmRepository 的 type: oci。版本通过 versions.env 中的变量配合 Flux 替换引用,并带 Renovate 注解。依赖管理支持发布级 dependsOn(等待其他 HelmRelease)与 ResourceSet 级 dependsOn(等待其他 ResourceSet)。

使用方式:ResourceSet 模板使用 Go text/template 与 << >> 分隔符,支持 inputs.field 取值、if/end 条件、range 循环、hasPrefix 前缀判断等。调试可用 kubectl get resourcesets -n flux-system、kubectl describe resourceset platform-resources -n flux-system、kubectl get helmreleases -A、kubectl describe helmrelease <name> -n <namespace>,以及 flux reconcile helmrelease <name> -n <namespace> 或 flux reconcile kustomization flux-system -n flux-system 强制协调。

限制:受限命名空间(cert-manager、external-secrets、system、database、kromgo)的每个容器(含 init 容器)需满足 PodSecurity 要求,如 runAsNonRoot、seccompProfile: RuntimeDefault、allowPrivilegeEscalation: false、capabilities.drop: ["ALL"]、readOnlyRootFilesystem: true;镜像以 root 运行时需设置 runAsUser: 65534。task k8s:validate 不会捕获 PodSecurity 违规,仅在准入时暴露。常见问题包括依赖未就绪、缺少值文件、chart 名称或 URL 错误、命名空间未创建。更多 ResourceSet 模式、版本管理与平台架构见 kubernetes/platform/CLAUDE.md,模板示例见 templates.md。