Helm chart scaffolding
Skill findscripter/everything-skills/02-engineering/helm-chart-scaffolding
类书式 AI Agent 技能大典 · 精选/中文化/互见成网的 500+ 开源技能,可作为 Claude Code 插件市场一键安装。A curated, cross-referenced encyclopedia of 500+ open-source agent skills.
npx -y skills add findscripter/everything-skills --skill helm-chart-scaffoldingAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
- 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
当需要为 Kubernetes 应用做 Helm Chart 打包、模板化与多环境部署时使用;产出标准目录结构、Chart.yaml/values.yaml、模板与校验打包流程;不适用于裸 K8s manifest 编写或 GitOps 自动发布编排。触发词:Helm、Chart、values.yaml、helm create、多环境部署。
The file declares its own license as MIT. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.
SKILL.md
5.8 KB, ~1.7k tokens by cl100k_base, as published. Nobody here has run it
何时使用
当你需要把 Kubernetes 应用打包成可复用、可分发的 Helm Chart 时使用,典型场景:
- 从零创建新 Chart,或把现有 K8s manifest 模板化
- 用 values 管理 dev/staging/prod 多环境差异
- 声明并锁定子 Chart 依赖(如 postgresql、redis)
- 搭建 Chart 仓库并对外分发
- 落地命名、标签、版本等 Helm 约定与最佳实践
不该用的边界:
- 任务与 Helm Chart 打包无关
- 只是编写一份裸 Kubernetes manifest(用 k8s-manifest-generator)
- 需要 GitOps/CI 自动化发布编排(用 gitops-workflow)
- 不能替代针对具体环境的实测、校验与专家评审;缺少必要输入、权限或成功标准时先停下来澄清
步骤
- 初始化结构:
helm create my-app生成标准骨架(Chart.yaml、values.yaml、charts/、templates/、.helmignore)。 - 配置
Chart.yaml(apiVersion: v2):填 name、version(Chart 版本,SemVer)、appVersion(应用版本)、description、type(application/library),按需加 keywords、maintainers、sources、kubeVersion: ">=1.24.0"。 - 设计
values.yaml:分层组织 image、replicaCount、service、ingress、resources、autoscaling、env,并对每个值写注释;可加values.schema.json做 JSON Schema 校验。 - 编写模板:在
templates/用 Go 模板 + Helm 函数,名字、标签统一走_helpers.tpl(*.fullname、*.labels、*.selectorLabels)。 - 管理依赖:在 Chart.yaml 的
dependencies里固定版本并加condition,执行helm dependency update/build拉取并生成 Chart.lock。 - 校验:
helm lint、helm template、helm install --dry-run --debug逐项验证。 - 多环境:用
values-dev/staging/prod.yaml覆盖差异,部署时-f指定。 - 打包分发:
helm package生成 tgz,helm repo index建索引并上传仓库。 - 钩子与测试:用
helm.sh/hook注解实现 pre-install 迁移等,在templates/tests/放测试 Pod,helm test运行。
指令
# 1. 初始化
helm create my-app
# 2. 依赖
helm dependency update # 拉取并生成 Chart.lock
helm dependency build
helm dependency list
# 3. 校验(打包前必做)
helm lint my-app/
helm template my-app ./my-app # 渲染查看
helm template my-app ./my-app -f values-prod.yaml
helm install my-app ./my-app --dry-run --debug
helm show values ./my-app
# 4. 打包与仓库
helm package my-app/ # 生成 my-app-1.0.0.tgz
helm repo index . --url https://charts.example.com
# 5. 安装与测试
helm install my-app ./my-app -f values-prod.yaml --namespace production
helm test my-app
约定(务必遵守):
- Chart 与依赖版本用 SemVer,依赖版本精确锁定(pin)。
- 模板文件小写加连字符(
service-account.yaml),partial 以下划线开头(_helpers.tpl)。 - CRD 放
crds/目录,不参与模板渲染、不随 Chart 升级或删除。 - Hook weight 控制顺序(-5 到 5,越小越先),常用删除策略
before-hook-creation,hook-succeeded。
示例
templates/deployment.yaml 的核心模板片段(命名与标签全部走 helper,镜像 tag 缺省回落到 AppVersion):
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "my-app.fullname" . }}
labels:
{{- include "my-app.labels" . | nindent 4 }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
selector:
matchLabels:
{{- include "my-app.selectorLabels" . | nindent 6 }}
template:
spec:
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
常用模式:
# 条件资源
{{- if .Values.ingress.enabled }} ... {{- end }}
# 遍历列表
{{- range .Values.env }}
- name: {{ .name }}
value: {{ .value | quote }}
{{- end }}
# 全局值(与子 Chart 共享)
global:
imageRegistry: docker.io
生产环境 values-prod.yaml 覆盖示例:
replicaCount: 5
image:
tag: "2.1.0"
autoscaling:
enabled: true
minReplicas: 3
maxReplicas: 20
ingress:
enabled: true
注意事项
- 字符串在模板里加
| quote,避免 YAML 解析歧义。 - 每个 value 写注释,重复逻辑抽进 helper,保持「一个应用一个 Chart」聚焦原则。
- 打包前务必跑
helm lint+helm template,渲染报错用--debug定位。 - 安装失败时组合
helm install --dry-run --debug与kubectl get events --sort-by='.lastTimestamp'排查。 - 数据库初始化等用
pre-installHook,别塞进普通模板。 - 渲染结果不能替代真实集群的 dry-run 与实测验证。
互见
- k8s-manifest-generator:生成基础 Kubernetes manifest
- gitops-workflow:Helm Chart 的自动化发布编排
采编自 sickn33/antigravity-awesome-skills(MIT 许可)。
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.