Feedback

Chat Icon

Cloud-Native Microservices With Kubernetes - 2nd Edition

A Comprehensive Guide to Building, Scaling, Deploying, Observing, and Managing Highly-Available Microservices in Kubernetes

Everything You Need to Know to Start Using Helm
92%

Default Helm Labels

In our previous example, we ran the following command to verify the installation:

kubectl get all -l app.kubernetes.io/instance=my-wordpress

The label app.kubernetes.io/instance is one of the default labels that Helm adds to all the Kubernetes resources it creates. This label helps identify which resources belong to a specific Helm release.

There are other default labels automatically added by Helm as well:

  • app.kubernetes.io/name: The name of the chart (e.g., wordpress).
  • app.kubernetes.io/version: The version of the application (e.g., 5.8.1).
  • app.kubernetes.io/managed-by: The tool managing the deployment (e.g., Helm).
  • app.kubernetes.io/component: The component within the application (e.g., web, database, frontend, backend etc., depending on the chart).
  • app.kubernetes.io/part-of: The name of the larger application this component is part of (e.g., my-application).
  • helm.sh/chart: The name and version of the chart (e.g., wordpress-10.1.5).

These labels are created based on the information provided in the Chart.yaml file and the release name specified during installation. The following table summarizes what's created and how:

LabelRequired/OptionalDescriptionHow it's Set
app.kubernetes.io/nameRequiredLogical name of the application. Groups all components belonging to a single app.Usually set using {{ template "name" . }}, which typically resolves to .Chart.Name.
helm.sh/chartRequiredIdentifies which chart and chart version produced this resource. Useful for auditing and debugging.Helm sets this via {{ .Chart.Name }}-{{ .Chart.Version \| replace "+" "_" }} so labels remain valid.
app.kubernetes.io/managed-byRequiredIndicates the management tool (always Helm for Helm-managed objects).Automatically set to {{ .Release.Service }}, which equals "Helm".
app.kubernetes.io/instanceRequiredDistinguishes different deployments of the same chart (prod, staging, test, etc.).Set to {{ .Release.Name }}, the name passed during helm install/upgrade.
app.kubernetes.io/versionOptionalVersion of the underlying application (e.g., WordPress, Redis), not the chart version.Usually set using {{ .Chart.AppVersion }} from Chart.yaml.
app.kubernetes.io/componentOptionalIdentifies the component role: frontend, backend, database, worker, etc.Manually defined in chart templates or values.yaml.
app.kubernetes.io/part-ofOptionalGroups multiple charts/components under one larger system or “application”.Manually set by chart authors using a fixed value or {{ .Values.appName }}.

Below is a practical explanation of every template reference that appears in the table:

{{ template "name" . }}

This calls a named template defined in _helpers.tpl files. Many charts include a template like this:

{{- define "name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}

Cloud-Native Microservices With Kubernetes - 2nd Edition

A Comprehensive Guide to Building, Scaling, Deploying, Observing, and Managing Highly-Available Microservices in Kubernetes

Enroll now to unlock all content and receive all future updates for free.