Skip to content
Tutorials Center
My learning

Topics

Lesson 28 of 38 ยท Repositories and OCI

Helm Plugins and Artifact Hub

Extend Helm with plugins such as helm-diff and helm-secrets, write a minimal plugin.yaml, and find community charts on Artifact Hub, with a plugin manifest stand-in.

Helm is deliberately small. Its core installs, upgrades and rolls back releases. Everything else, from showing a diff before an upgrade to decrypting secrets, comes from plugins: external programs that Helm runs as if they were built-in subcommands. Alongside plugins, Artifact Hub is where the community publishes and discovers charts. This lesson covers both.

Installing and managing plugins

Terminal
helm plugin install https://github.com/databus23/helm-diff
helm plugin list
helm plugin update diff
helm plugin uninstall diff

A plugin is just a folder (cloned or downloaded) under Helm's plugin directory, shown by helm env HELM_PLUGINS. Because plugins run arbitrary code with your credentials, treat them like any dependency: pin versions (--version v3.9.0), prefer plugins from known maintainers, and verify them in CI images instead of installing from the internet at run time.

Plugins worth knowing

Plugin What it adds
diff helm diff upgrade shows exactly what an upgrade would change in the cluster
secrets Encrypt values files with SOPS and decrypt on the fly
unittest Unit tests for templates (see Helm unit tests)
s3 / gcs Use object storage as a repository with private credentials
mapkubeapis Update release records that use removed Kubernetes APIs
schema Generate values.schema.json from a values file
dashboard A local web UI over your releases

helm diff is the one almost every team adopts. Compare it with the built-in helm template: template shows what would be rendered, diff shows how it differs from what is running.

Terminal
helm diff upgrade shop ./webapp -f prod.yaml --context 3

Using diff as a required review step before helm upgrade catches accidental changes, such as an image tag that changed because a default moved.

Writing a minimal plugin

A plugin needs a directory and a plugin.yaml:

TEXT
helm-hello/
  plugin.yaml
  hello.sh
YAML
name: "hello"
version: "0.1.0"
usage: "Say hello with the current release name"
description: "A tiny example plugin"
command: "$HELM_PLUGIN_DIR/hello.sh"
Terminal
#!/bin/sh
echo "Hello from $HELM_PLUGIN_NAME, namespace is ${HELM_NAMESPACE}"

Install from the local folder and run it:

Terminal
helm plugin install ./helm-hello
helm hello

Helm sets environment variables for the plugin: HELM_PLUGIN_DIR, HELM_PLUGIN_NAME, HELM_NAMESPACE, HELM_KUBECONTEXT, HELM_BIN and more, so the plugin can call back into $HELM_BIN. Plugins can also declare hooks (install, update, delete) that build binaries at install time, and platformCommand entries for different operating systems.

The stand-in validates a plugin.yaml the way a plugin loader would. Helm itself is written in Go and checks more; this shows the idea.

Python Stand-in: validate a plugin manifest

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Post-renderers: another extension point

Not every extension is a plugin. A post-renderer is a program that receives the rendered manifests on stdin and prints modified manifests on stdout. Helm runs it between rendering and applying:

Terminal
helm install shop ./webapp --post-renderer ./add-labels.sh

Typical uses: apply Kustomize patches to a chart you cannot edit, or inject sidecars. Keep post-renderers deterministic and fast, and test them with helm template --post-renderer.

Python Stand-in: a post-renderer that adds a label

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Artifact Hub

Artifact Hub is a public search site for Kubernetes packages: Helm charts, operators, Tekton tasks and more. It does not host charts. Publishers register a repository (classic or OCI) and Artifact Hub reads its metadata. For a user it provides:

  • Search by keyword, with filters for verified publishers and official charts.
  • Each chart's readme, values reference, templates and security report.
  • The exact helm repo add and helm install commands.

For a publisher, you improve discoverability with metadata in Chart.yaml:

YAML
keywords: [web, demo]
home: https://example.com/webapp
sources:
  - https://github.com/my-org/webapp
maintainers:
  - name: Platform team
    email: [email protected]
icon: https://example.com/webapp.svg
annotations:
  artifacthub.io/category: integration-delivery
  artifacthub.io/license: Apache-2.0

and an artifacthub-repo.yml at the root of the repository to claim ownership and earn the verified-publisher badge.

Vet before you install

Popular does not mean safe or maintained. Before adopting a public chart, check: last release date, open issues, whether the image comes from an official source, whether defaults are secure (no root, resource limits, no latest tags), and read the rendered manifests with helm template. The security lesson turns this into a checklist.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What does helm diff upgrade show?

    The diff plugin compares the new rendered manifests against the live release.
  2. 2. Which file makes a folder a Helm plugin?

    plugin.yaml declares name, version, usage, and the command to run.
  3. 3. Does Artifact Hub store the chart packages?

    It is a discovery site; the packages stay in the publisher's repository.
  4. 4. A post-renderer receives what on stdin?

    It reads rendered YAML, transforms it and writes YAML to stdout.

Summary

  • Plugins add subcommands (diff, secrets, unittest); install with helm plugin install and pin versions.
  • A plugin is a folder with plugin.yaml and a command; Helm passes context in environment variables.
  • Post-renderers modify rendered manifests before they are applied.
  • Artifact Hub is the discovery layer; vet any public chart before use.

Next: Linting and Debugging Templates