0Pricing
Helm Academy · Lesson

Environments and Per-Env Values

Promoting the same setup from dev to prod.

Environments and Per-Env Values is a free Helm Academy lesson on CoddyKit — lesson 3 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Helm Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

One Stack, Many Stages

Dev, staging, and prod run the same apps with different settings. Helmfile environments let one file describe all of them cleanly.

The environments Block

You declare each stage under a top-level environments block. Each named environment can load its own values file.

environments:
  dev:
    values:
      - envs/dev.yaml
  prod:
    values:
      - envs/prod.yaml

Select with -e

You choose the active environment on the command line with -e. Helmfile then loads only that environment's values.

helmfile -e prod sync

The .Environment.Values Tree

Loaded values land in .Environment.Values. You read them with Go template syntax anywhere in your helmfile.yaml.

{{ .Environment.Values.replicaCount }}

Per-Env Replica Counts

A classic use: dev runs one replica, prod runs many. You template the set value from the environment instead of hardcoding it.

set:
  - name: replicaCount
    value: {{ .Environment.Values.replicaCount }}

Shared Base, Env Override

List a base values file first, then the env file. The environment file overrides only the keys that differ, keeping shared config in one place.

values:
  - envs/base.yaml
  - envs/{{ .Environment.Name }}.yaml

The .Environment.Name Helper

.Environment.Name gives the active environment's name as a string. It is great for naming, labels, or choosing a file path dynamically.

namespace: app-{{ .Environment.Name }}

A Default Environment

Define a default environment so a plain helmfile command still works without -e. It runs when no environment is specified.

environments:
  default:
    values:
      - envs/dev.yaml

Inline Env Values

Small differences can live inline under an environment instead of a file. Use values with a map for just a key or two.

environments:
  prod:
    values:
      - replicaCount: 5

Promote Without Forking

Because logic is shared and only values change, you promote the same release from dev to prod by switching -e, not by copying files.

Keep Secrets Out

Environment value files often hold sensitive config. Keep real secrets encrypted or in a vault, never as plaintext in these files in Git.

Quick Check

You want to deploy the prod stage of your helmfile.yaml. How do you select it?

Recap: Environments

You learned to define environments, select one with -e, and read .Environment.Values to promote the same stack across stages. Next: applying it. 🚀

Frequently asked questions

Is the “Environments and Per-Env Values” lesson free?

Yes — the full text of “Environments and Per-Env Values” is free to read here on the web, and the Helm Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Helm Academy course, upgrade to CoddyKit PRO.

What will I learn in “Environments and Per-Env Values”?

Promoting the same setup from dev to prod. You practise Helm Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start Helm Academy?

No prior experience is required. Helm Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 3 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Environments and Per-Env Values” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this Helm Academy lesson?

Yes. Every Helm Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. Why Helmfile Sits Above Helm
  2. Defining Releases in helmfile.yaml
  3. Environments and Per-Env Values
  4. helmfile diff, apply, and sync
← Back to Helm Academy