Format Helm Chart values.yaml Files

Format and validate Helm chart values.yaml files with proper structure for image tags, resource limits, ingress rules, and environment-specific overrides. Follow Helm chart best practices.

Real-World

Detailed Explanation

Helm values.yaml Formatting

Helm is the package manager for Kubernetes, and the values.yaml file is the primary configuration interface for Helm charts. This file defines default values that templates consume to generate Kubernetes manifests.

values.yaml Structure

# Default values for my-app chart
replicaCount: 3

image:
  repository: my-registry.io/my-app
  tag: "1.5.2"
  pullPolicy: IfNotPresent

service:
  type: ClusterIP
  port: 80

ingress:
  enabled: true
  className: nginx
  annotations:
    cert-manager.io/cluster-issuer: letsencrypt-prod
  hosts:
    - host: app.example.com
      paths:
        - path: /
          pathType: Prefix
  tls:
    - secretName: app-tls
      hosts:
        - app.example.com

resources:
  requests:
    cpu: 100m
    memory: 128Mi
  limits:
    cpu: 500m
    memory: 256Mi

env:
  - name: DATABASE_URL
    valueFrom:
      secretKeyRef:
        name: app-secrets
        key: database-url

autoscaling:
  enabled: false
  minReplicas: 2
  maxReplicas: 10
  targetCPUUtilizationPercentage: 80

Formatting Best Practices

  1. Quote image tagstag: "1.5.2" not tag: 1.5.2 (prevents float parsing)
  2. Quote resource valuescpu: "100m" to prevent numeric interpretation of the m suffix
  3. Group related values — Keep image config, service config, and ingress config in separate sections
  4. Comment sections — Use comments to explain the purpose of each section, especially for values that templates reference
  5. Consistent boolean style — Use true/false (lowercase) consistently

Environment-Specific Overrides

Helm supports value overrides for different environments:

# values-production.yaml (overrides defaults)
replicaCount: 5

resources:
  requests:
    cpu: 500m
    memory: 512Mi
  limits:
    cpu: "1"
    memory: 1Gi

autoscaling:
  enabled: true
  minReplicas: 3
  maxReplicas: 20

Common Mistakes

  • Forgetting to quote numeric strings — Kubernetes resource values like 100m or image tags like 3.9 are parsed as numbers
  • Nested key conflicts — Overriding a single nested key replaces the entire parent mapping unless using Helm's deep merge
  • Unused values — Large values.yaml files accumulate keys that no template references
  • Missing defaults — All values referenced in templates should have defaults in values.yaml

Use Case

Helm values.yaml formatting is essential for teams deploying applications to Kubernetes. Well-formatted values files make it easy to understand what is configurable, compare environment-specific overrides, and review changes in pull requests. Chart maintainers benefit from consistent formatting when managing charts used by multiple teams.

Try It — YAML Formatter & Validator

Open full tool