Course contentsShow
← Cloud and Infrastructure
Lesson 1546 of 2,98931. Helm Package ManagerFree lesson

Subcharts and Values Overrides

Work with subcharts, override their values from parent charts, and understand subchart value scope and access.

Subcharts and Values Overrides

What you'll learn: How to customize subchart behavior by overriding their values from the parent chart while respecting proper scope boundaries.

What Are Subcharts?

When you declare chart dependencies (as you learned previously), those dependencies become subcharts — self-contained charts nested inside your parent chart. Each subchart has its own values.yaml file with default settings, but your parent chart can override those values to customize how the subchart behaves.

Think of it like ordering a pre-configured meal package that includes sides. You can accept the default sides or specify substitutions without changing the vendor's original menu.

Overriding Subchart Values

In your parent chart's values.yaml, you override subchart values by nesting them under the subchart's name:

# Parent chart values.yaml
myapp:
  replicas: 3

# Override values for a subchart named "postgresql"
postgresql:
  auth:
    username: customuser
    password: custompass
  persistence:
    size: 20Gi

The postgresql key targets the subchart, and everything beneath it replaces or merges with the subchart's defaults.

Value Scope and Access

Critical rule: Subcharts cannot access parent chart values. This isolation is intentional — subcharts remain independent and reusable. Values flow downward only, from parent to subchart.

However, the parent chart can access its own values and override anything in its subcharts. Subcharts can also have their own nested subcharts, creating a hierarchy where each level can override the level below.

If you need to share common values across multiple subcharts, define them in the parent's values.yaml and explicitly override each subchart separately — there's no automatic "global" inheritance between siblings.

Key Takeaway:
Subcharts receive values only from their parent through explicit overrides; they cannot access parent values directly, ensuring encapsulation and reusability.