From manifest overload to modular design: Writing custom Helm charts

Published: 2026-11-16

While developing new service for my homelab, I eventually needed to start testing it within a Kubernetes environment. The service in question facilitated the exchange of information between several different services. This meant that the testing cluster also had to maintain those dependencies. And, while writing all the manifests, the thought occurred to me: haven’t I done all this already? Why am I repeating all this work?

Yes, I had done this already: the manifests were already in my homelab, but the values were tightly coupled to that single environment. While this wasn’t a design flaw of my homelab, it served as a clear catalyst for designing a modular system. I needed a way to quickly compose clusters and layer on values for different environments.

The key to creating this library of resources came in the form of a tool I was already familiar with: Helm.

Why Helm ?

Recognized as the package manager for Kubernetes, Helm makes putting together deployments manageable. It abstracts all the necessary Kubernetes resources (Services, Deployments, ConfigMaps, etc.) all into one values.yaml file. This values.yaml acts as a blueprint for supplying variables for generating application manifests. Under the hood, all this is made possible thanks to Go’s text/template library.

Having been a long-time consumer of others’ Helm charts, I knew I could leverage Helm templating to write my own purpose made charts to reduce repetitiveness of writing and rewriting similarly shaped Kubernetes resources. Armed with this knowledge, I dove into the practical application of Helm templating.

Learning Helm templating

The Helm documentation was a massive resource to help me get started writing Helm charts. They go into great detail on suggested directory structures, Go templating syntax, and controlling logic flow. To avoid retreading that content, I though it’d be more helpful to share and reflect on what I learned following their guide.

Starting off, here’s some extra tips and tricks that proved helpful while implementing my own charts:

  • Use helm template -f <CHART_PATH> to inspect what manifests are generated by your chart. Rather than following the documentation’s suggestion to use helm install -f <CHART_PATH> to check your work, I found the template command safer to use. It doesn’t require an active connection to a Kubernetes cluster, and can save you from accidentally applying broken charts to a production cluster!
  • The --debug flag is your friend. Mapping in partials into your charts can sometimes require a few guess-and-check iterations. Appending the debug flag onto commands will render out any invalid YAML and show you where you went wrong.
  • Use helm-ls and yaml-language-server to help you write your chart. These third-party tools provide you with the ability to validate your work and check for mistakes before you run Helm. In addition, helm-ls saves time by providing values.yaml autocompletions for writing templates.

Using what I had learned, I was able to put together a flexible blueprint for generating ExternalSecret manifests.

# templates/external-secret.yaml
apiVersion: external-secrets.io/v1
kind: ExternalSecret
metadata:
  name: {{ .Release.Name | quote }}
  namespace: {{ .Release.Namespace | quote }}
spec:
  refreshInterval: {{ .Values.reconciliation }}
  secretStoreRef:
    name: {{ .Values.store.name | quote }}
    kind: {{ .Values.store.cluster | ternary "ClusterSecretStore" "SecretStore" }}
  {{- if any .Values.dataFrom }}
  dataFrom:
    {{- range .Values.dataFrom }}
    - extract:
        key: {{ list $.Release.Name $.Values.context . | join "/" | quote }}
    {{- end }}
  {{- end }}
  {{- if any .Values.data }}
  data:
    {{- range .Values.data }}
    - secretKey: {{ .secretKey | quote }}
      remoteRef:
        property: {{ .remoteKey | quote }}
        key: {{ list $.Release.Name $.Values.context .path | join "/" | quote }}
    {{- end }}
  {{- end }}
# values.yaml
context: dev
reconciliation: 1h

store:
  name: cluster-secret-store
  # Namespace for secrets to reference
  namespace: external-secrets
  # Determines if the secret store provides for the cluster
  # or just the namespace
  cluster: true

dataFrom: []
data: []

Now, any of my clusters that consume the above chart can quickly define a namespace scoped SecretStore or a cluster-wide ClusterSecretStore and the chart’s values.yaml provides them with sane but customizable defaults. Using this abstraction, I’ve reduced the configuration overhead significantly, needing only to define the data and dataFrom keys. Also, common patterns of configuration now can be standardized, enforced, and modified across my fleet of clusters with ease!

Next steps

Writing the charts is only the beginning. With what I covered, I can generate repetitive manifests via Helm, but how can my clusters consume my charts!? That’s a topic I’ll cover in my next article on Helm.

Do you have a cool idea? I love helping bring complex visions to life.

Say hi or follow me here: