You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In this project, Helm charts will typically be found in a `/charts/$chart-name` subdirectory.
7
+
8
+
# Helm Chart Best Practices
9
+
10
+
This document contains best practices for creating Helm charts, based on the official Helm documentation at https://helm.sh/docs/chart_best_practices/.
11
+
12
+
## General Conventions
13
+
14
+
- Chart names should use lowercase letters, numbers, and dashes (no uppercase or underscores)
15
+
- Chart names should be descriptive without being too long
16
+
- Version numbers should follow SemVer 2 standard
17
+
- Reuse official base images for your charts where possible
18
+
- Document all chart dependencies
19
+
- Keep chart simple and focused on one application per chart
20
+
- Ensure your chart properly handles upgrades and rollbacks
21
+
22
+
## Values
23
+
24
+
- Use camelCase for key names in values.yaml
25
+
- Document all values using comments in values.yaml
26
+
- Define sensible defaults that work out-of-the-box
27
+
- Use appropriate data types (string, int, boolean, etc.)
28
+
- Structure values hierarchically when appropriate
29
+
- Mark sensitive values with comments
30
+
- Use a flat structure for values that represent environment variables
31
+
32
+
## Templates
33
+
34
+
- Clearly structure template files in the templates/ directory
35
+
- Use the include function instead of template for reusable template blocks
36
+
- Add helpful NOTES.txt for users after installation
37
+
- Template functions should use lowercase (e.g., quote not Quote)
38
+
- Whitespace formatting: use YAML's indent feature (|-) for readability
39
+
- Use standard Kubernetes naming conventions in templates
40
+
- Templates should emit valid YAML
41
+
- Validate templates with `helm lint` and `helm template`
42
+
43
+
## Dependencies
44
+
45
+
- Use the requirements.yaml file to manage dependencies
46
+
- Pin versions of dependencies to specific ranges
47
+
- Document what your dependencies provide and how they're used
48
+
- Set appropriate global values that dependencies can access
49
+
- Minimize external dependencies when possible
50
+
- Use conditions to enable/disable dependencies where appropriate
51
+
52
+
## Labels and Annotations
53
+
54
+
- Include Helm-recommended labels:
55
+
- app.kubernetes.io/name
56
+
- app.kubernetes.io/instance
57
+
- app.kubernetes.io/version
58
+
- app.kubernetes.io/managed-by
59
+
- helm.sh/chart
60
+
- Use namespaces with your custom labels to avoid collisions
61
+
- Keep annotations focused on tools that will use them
62
+
- Don't use annotations when labels are more appropriate
63
+
- Follow Kubernetes label syntax constraints
64
+
65
+
## Pods and PodTemplates
66
+
67
+
- Set appropriate container resources (requests and limits)
68
+
- Create useful liveness and readiness probes
69
+
- Set security context settings appropriately
70
+
- Use init containers correctly if needed
71
+
- Define suitable update strategies
72
+
- Set appropriate termination periods
73
+
- Handle persistent volumes properly
74
+
75
+
## Custom Resource Definitions (CRDs)
76
+
77
+
- Place CRDs in the crds/ directory (not templates/)
78
+
- Document clearly which CRDs your chart requires
79
+
- Label your CRDs appropriately
80
+
- Consider separation of CRD installation and application installation
0 commit comments