Add additional annotations to the existing helm chart

Saket Jain
2 min readSep 21, 2021

My scenario for this blog was I want to add some annotations to the metadata block of service within an existing helm chart (I have to add an annotation for Prometheus so that the service is auto-discovered)

Helm chart is a popular method of packaging applications to be installed on the Kubernetes cluster. As Helm chart developers, we have to decide what configurations need to be made available to the customer and how should they be offered. In this article, we look at configuring labels and annotations. All Kubernetes objects should have a set of labels for external tools to identify and use them in a consistent manner. Specifying labels and annotations involves solving some key challenges.


As mentioned, annotations are arbitrary key/value pairs that are added to the existing Kubernetes definitions. One common use case is that of service discovery for the Prometheus time-series database.

Service YAML

Service with mandatory labels required of all Kubernetes objects and customer-provided annotations.

{{ toYaml .Values.SERVICE.ANNOTATIONS | indent 4 }}

Deployment vars default YAML

  • "/actuator/prometheus": Which endpoint to make the HTTP request to
  • '8080': On which port to make the HTTP request
  • 'True’: Whether to enable scraping this resource

Running the upgrade command will trigger the update:

$ helm upgrade --install <name of your service> .

we can see our annotation! applied successfully command below to validate

$ kubectl describe service <name of the service> -n <namespace>
kind: Service
apiVersion: v1
name: <name of the service>
namespace: <namespace>
selfLink: /api/v1/namespaces/<namespace>/services/<name of the service>
uid: 4a3de942-b2ce-453e-888e-13c04333f7d5
resourceVersion: '77637655'
creationTimestamp: '2021-09-21T15:05:32Z'
app: rider-service Helm
annotations: <name of the service> <namespace> /actuator/prometheus '8080' 'true'


Labels and annotations are one of the main foundations for Kubernetes. They are both ways of adding metadata to Kubernetes objects. Kubernetes labels allow us to identify, select, and operate on Kubernetes objects, whereas annotations are non-identifying metadata.

They are used by external tools to help them to provide extra functionalities. However, there are no standard practices enforced. In this article, we attempted to provide a guideline that will serve as best practices when labeling and annotating Kubernetes objects.