How to create your first Helm plugin?

How to create your first Helm plugin?


Helm helps you manage Kubernetes applications using helm charts. Helm Charts help you define, install, and upgrade Kubernetes applications.


# add chart repository
helm repo add bitnami

# update charts
helm repo update

# install mysql using helm chart by bitnami
helm install bitnami/mysql --generate-name

Helm plugins

Helm plugins provide a way to extend Helm features without modifying the helm core codebase.

Helm plugins have the following features:

  • They can be added and removed from a Helm installation without impacting the core Helm tool.
  • They can be written in any programming language.
  • They integrate with Helm, and will show up in helm help and other places.

Helm plugins are stored in $HELM_PLUGINS directory, you can change this using helm env command.

Install a helm plugin

A Helm plugin can be installed from a git repo, a tar release or from a local directory.

helm plugin install <path|url>

Helm plugin anatomy

A helm plugin constists of a plugin.yaml file, which has the plugin definition and its associated commands.

   ├── plugin.yaml

plugin definition

plugin.yaml defines the name, usage, description and command to run when invoked.

  • The Command can point to your own script of any programming language.
  • The ignoreFlags switch tells Helm to not pass flags to the plugin.

So if a plugin is called with helm myplugin --foo and ignoreFlags: true, then --foo is silently discarded.


name: fullenv
usage: "show env vars"
description: "show all env vars"
command: "$HELM_PLUGIN_DIR/"
ignoreFlags: true - just prints helm environment variables.

echo $HELM_BIN

Platform specific commands

Helm plugin commands can be configured to target a os platform and architecture.

name: fullenv
usage: "show env vars"
description: "show all env vars"
command: "$HELM_PLUGIN_DIR/"
  - os: linux
    arch: i386
    command: "$HELM_PLUGIN_DIR/"
  - os: linux
    arch: amd64
    command: "$HELM_PLUGIN_DIR/"

Helm follows the below rules to choose a command.

  • If platformCommand is present, it will be searched first.
  • If both os and arch match the current platform, search will stop and the command will be used.
  • If os matches and there is no more specific arch match, the command will be used.
  • If no platformCommand match is found, the default command will be used.
  • If no matches are found in platformCommand and no command is present, Helm will exit with an error.

Install the plugin

cd into the plugin directory and then run the command below

# install
helm plugin install .

# check if the installation is successful
helm plugin list

Test the plugin

helm fullenv

If you like this article, subscribe to the newsletter and Connect with me on twitter to get updates on my future articles. ✅

Did you find this article valuable?

Support Suresh Kumar by becoming a sponsor. Any amount is appreciated!