# Helm Chart 结构参考
Helm Chart 组织结构、文件约定和最佳实践的完整指南。
## 标准 Chart 目录结构
my-app/
├── Chart.yaml # Chart 元数据 (必需)
├── Chart.lock # 依赖锁定文件 (自动生成)
├── values.yaml # 默认配置值 (必需)
├── values.schema.json # 用于值验证的 JSON schema
├── .helmignore # 打包时忽略的模式
├── README.md # Chart 文档
├── LICENSE # Chart 许可证
├── charts/ # Chart 依赖 (捆绑)
│ └── postgresql-12.0.0.tgz
├── crds/ # 自定义资源定义 (CRD)
│ └── my-crd.yaml
├── templates/ # Kubernetes 清单模板 (必需)
│ ├── NOTES.txt # 安装后说明
│ ├── _helpers.tpl # 模板辅助函数
│ ├── deployment.yaml
│ ├── service.yaml
│ ├── ingress.yaml
│ ├── configmap.yaml
│ ├── secret.yaml
│ ├── serviceaccount.yaml
│ ├── hpa.yaml
│ ├── pdb.yaml
│ ├── networkpolicy.yaml
│ └── tests/
│ └── test-connection.yaml
└── files/ # 需要包含的额外文件
└── config/
└── app.conf
## Chart.yaml 规范
### API 版本 v2 (Helm 3+)
yaml
apiVersion: v2 # 必需: API 版本
name: my-application # 必需: Chart 名称
version: 1.2.3 # 必需: Chart 版本 (SemVer)
appVersion: "2.5.0" # 应用版本
description: A Helm chart for my application # 必需
type: application # Chart 类型: application 或 library
keywords: # 搜索关键字
- web
- api
- backend
home: https://example.com # 项目主页
sources: # 源代码 URL
- https://github.com/example/my-app
maintainers: # 维护者列表
- name: John Doe
email:
[email protected]
url: https://github.com/johndoe
icon: https://example.com/icon.png # Chart 图标 URL
kubeVersion: ">=1.24.0" # 兼容的 Kubernetes 版本
deprecated: false # 标记 Chart 是否已弃用
annotations: # 任意注解
example.com/release-notes: https://example.com/releases/v1.2.3
dependencies: # Chart 依赖
- name: postgresql
version: "12.0.0"
repository: "https://charts.b