K8sCalc

kubernetes

Helm Chart values.yaml Generator

Generate a Helm chart values.yaml with image, replicas, resources, service, ingress, and environment variable sections. Ready to use with helm install --values.

Helm Charts and values.yaml

Helm is the Kubernetes package manager. A chart is a directory of YAML templates + values.yaml defaults.

Chart Structure

my-chart/
├── Chart.yaml          # chart metadata
├── values.yaml         # default values (generated here)
└── templates/
    ├── deployment.yaml # uses {{ .Values.replicaCount }}
    ├── service.yaml
    └── ingress.yaml

Template Syntax

yaml
# templates/deployment.yaml
replicas: {{ .Values.replicaCount }}
image: {{ .Values.image.repository }}:{{ .Values.image.tag }}

Multi-environment Pattern

values.yaml          ← defaults (committed to repo)
values-prod.yaml     ← prod overrides (committed)
values-staging.yaml  ← staging overrides (committed)
bash
# Deploy to prod
helm upgrade --install my-app ./chart \
  --values values.yaml \
  --values values-prod.yaml \
  --namespace production

Useful Commands

bash
helm template ./chart --values values.yaml   # preview rendered YAML
helm lint ./chart                            # validate chart
helm diff upgrade my-app ./chart --values values.yaml  # show what changes

Frequently Asked Questions

What is values.yaml used for?

values.yaml is the default configuration file for a Helm chart. It defines all the variables the chart templates reference via {{ .Values.* }}. When you run helm install, Helm merges values.yaml with any --values overrides you pass. This lets you deploy the same chart to dev/staging/prod with different settings without changing the chart itself.

How do I override values at deploy time?

Use --set for single values: helm upgrade my-app ./chart --set image.tag=sha-abc123. Use --values for a full file: helm upgrade my-app ./chart --values prod-values.yaml. Multiple --values files are merged left-to-right, with later files winning. This is the GitOps pattern: commit environment-specific overrides to your repo.

How do I pass secrets via Helm values?

Never put secrets in values.yaml committed to Git. Instead: use --set for CI/CD secrets (helm upgrade --set db.password=$DB_PASS), use external-secrets to pull from Vault/AWS SSM, or use Sealed Secrets for encrypted secrets in Git. The {{ .Values.secret }} pattern is fine for non-sensitive config; use Kubernetes Secrets for credentials.

What's the difference between helm install and helm upgrade --install?

helm install creates a new release. If the release already exists, it fails. helm upgrade --install does both: upgrades if the release exists, installs if it doesn't. In CI/CD, always use helm upgrade --install so the pipeline works for both first-time deploys and updates.