skip to content

In a Helm Chart.yaml, what does apiVersion: v2 declare, and which fields are mandatory?

level: middleimportance: should knowfreq 56%

answer

  1. It is the file's format, not the app's
  2. Shorter required list than the scaffold suggests
  3. Three fields, and no more
  4. v1 kept dependencies in a separate file
  5. One optional field decides installability

basics

~20 s

apiVersion: v2 marks the chart as the modern chart format used by Helm 3 and Helm 4: dependencies are declared inside Chart.yaml and the type field exists. Only apiVersion, name and version are mandatory; every other field is optional metadata.

solid answer

~50 s

`apiVersion` is the chart *format* version, not the chart's version and not a Kubernetes API version. `v2` is the format Helm 3 and Helm 4 write and the only one you should publish: it moved dependency declarations into `Chart.yaml` itself (the older `v1` format kept them in a separate `requirements.yaml`) and added the `type` field. Helm requires exactly three fields — `apiVersion`, `name` and `version` — and refuses to load a chart missing any of them. `name` must be lowercase alphanumeric with dashes and normally matches the chart's directory; it is the *chart* name, not the release name, which the caller chooses at install time. `type` defaults to `application`; a chart declaring `type: library` renders no manifests of its own and Helm will not install it directly. Everything else — `description`, `appVersion`, `kubeVersion`, `keywords`, `maintainers`, `icon`, `home`, `sources`, `deprecated`, `annotations` — is optional.

code

yaml · 15 lines
yaml
# The three required fields
apiVersion: v2
name: tile-server
version: 2.14.3

# Everything below here is optional
type: application
description: Serves vector map tiles
appVersion: "7.9.2"
kubeVersion: ">=1.28.0-0"
maintainers:
  - name: mapping-platform
    email: [email protected]
annotations:
  category: Mapping

go deeper

for a junior

Know that apiVersion: v2 at the top of Chart.yaml names the chart format, and that helm create writes it for you. Being able to point at the three fields Helm actually insists on is enough here.

for a middle

Explain what the v2 format changed — dependencies moved into Chart.yaml and type appeared — and which of the scaffold's fields are load-bearing versus decorative. Expect a follow-up on chart name versus release name.

for a senior

Be ready to discuss consequences: a name/directory mismatch, why a library chart refuses to install, and why the chart format is stable enough that consumers on Helm 3 and Helm 4 read the same file.

for a principal

Own the standard your organisation publishes to: which optional metadata is mandatory by policy rather than by Helm, how charts are linted for it, and why chasing an experimental chart format offers nothing to a shared catalogue.

## What `apiVersion` names, and what it doesn't The word `apiVersion` appears twice in a Helm chart's world and means different things each time. Inside `templates/`, an `apiVersion:` line is a Kubernetes API group and version on a rendered object. At the top of `Chart.yaml`, `apiVersion` is the version of the **chart file format itself** — the schema Helm uses to read that file. It takes a literal value, not a number: `v2` is the format Helm 3 and Helm 4 write and read, and `v1` is the older Helm 2-era format. ## What `v2` changed from `v1` The practical difference between the two formats is where a chart's dependencies live and whether the chart can declare a type. | Axis | `v1` | `v2` | |---|---|---| | Dependencies declared in | a separate `requirements.yaml` beside `Chart.yaml` | `Chart.yaml` itself, as a `dependencies` list | | `type` field | none — no notion of a chart that is not installable | present, with two legal values, `application` and `library` | That is the whole of it: `apiVersion: v2` is a statement about the metadata file's shape, and a candidate who says it selects a Kubernetes API version, or that it is somehow related to `version` or `appVersion`, has missed the layer it lives at. ## The three mandatory fields Helm requires `apiVersion`, `name` and `version`. A `Chart.yaml` missing any one of them fails to load — you get an error before anything renders, from `helm install`, `helm template` and `helm lint` alike. That is a shorter list than most people expect, because the scaffold `helm create` writes about ten fields and they all look obligatory. `description`, `appVersion`, `type`, `kubeVersion`, `home`, `sources`, `keywords`, `maintainers`, `icon`, `deprecated` and `annotations` are every one of them **optional**. ## `name`, and the ambiguity it invites `name` is the chart's name: lowercase letters, digits and dashes, and by convention identical to the directory the chart lives in — `helm lint` will complain when the two disagree, and `helm package` names the tarball from the `name` field regardless of what the directory is called, which is exactly how you end up with a `foo-1.0.0.tgz` inside a directory called `bar`. It is *not* the release name. A release name is chosen by whoever installs (`helm install tiles ./tile-server`) and reaches templates as `.Release.Name`, while the chart name reaches them as `.Chart.Name`. This matters for a chart designed to be installed more than once: a multi-tenant chart installed once per team namespace has one chart name and seventeen release names, which is why resource names in a well-written chart are derived from the release name rather than the chart name. ## `type`, and the optional fields worth knowing exist `type` has two legal values. `application` is the default and means what it sounds like: the chart renders manifests and can be installed. `library` means the chart exists to be consumed by other charts — it renders nothing of its own, and Helm refuses to install it directly, reporting that library charts are not installable. Mechanically, that refusal is the whole of what the `type` field changes; what a library chart is *for* and how you design one is a separate discussion. Four more optional fields are worth recognising, none of which affect rendering: - `kubeVersion` holds a SemVer range of Kubernetes versions the chart supports, and Helm enforces it. - `deprecated: true` is a boolean that marks a chart as no longer maintained, which chart catalogues and search use to hide it. - `annotations` is a free-form string map of chart-level metadata that Helm carries but does not act on. - `maintainers` is a list of `name`/`email`/`url` entries, and `icon` is a URL. ## Helm 4, and how this gets asked Helm 4 contains an experimental `v3` chart format, gated behind the `HELM_EXPERIMENTAL_CHART_V3` environment variable and living in an internal package. It is not something to author against: charts you publish today are `apiVersion: v2` whether the consumer runs Helm 3 or Helm 4, and the top-level command set for working with them is identical across both. If an interviewer asks what changed for chart metadata in Helm 4, the honest and correct answer is: nothing in the field set. The question usually arrives as a quick probe — "what does `v2` mean?" — followed by "and what happens if I delete `description`?" The answer to the second is *nothing*, and being confident about which fields are load-bearing versus decorative is what the question is actually measuring.

  • What breaks if the name field disagrees with the chart's directory name?
    Rendering still works — templates read `.Chart.Name` from the field, not from the path. `helm lint` flags the mismatch, and `helm package` writes the tarball as `<name>-<version>.tgz`, so you get a tarball whose filename does not match the directory it came from. The real damage is human: a chart unpacked from that tarball lands in a directory named after the field, and people looking for it by directory name stop finding it.
  • Can a chart declaring type: library be installed on its own?
    No. Helm refuses, reporting that library charts are not installable. A library chart contributes named templates to charts that depend on it and renders no manifests itself, so there is nothing for an install to apply. If you want a chart that installs nothing but exists as a grouping, that is still `type: application` — an application chart with an empty `templates/` directory.
  • Does apiVersion in Chart.yaml have anything to do with the Kubernetes API versions in templates/?
    No — they only share a spelling. `Chart.yaml`'s `apiVersion` names the chart file format (`v2`), while an `apiVersion` inside a template names a Kubernetes API group and version on a rendered object. Which Kubernetes API versions a chart may safely emit is a separate concern, expressed with `kubeVersion` and with capability checks inside templates.

saying these in an interview costs you the question

  • Says apiVersion v2 is a Kubernetes API version
  • Thinks description or appVersion is mandatory
  • Confuses the chart name with the release name
  • Believes v2 means the second version of the chart
  • Claims Helm 4 changed the Chart.yaml field set
  • Expects a library chart to install like any other

context