How to use Helm Plugins in Helm Chart [2 Examples]

In this article we are going to cover how to use helm plugins in helm chart with example. Helm’s extensibility is one of its key strengths, allowing users to enhance its functionality through plugins. Helm plugins can be utilized to add new commands, manage repositories, or introduce custom features to streamline Kubernetes operations.

Prerequisites

  • AWS Account with Ubuntu 22.04 LTS EC2 Instance
  • Minikube and kubectl Installed

Install Minikube and kubectl by following the official documentation for your operating system:

Minikube Installation Guide

Install Minikube on Ubuntu 22.04 LTS

  • Helm Installed:

Install Helm by following the official documentation:

Helm Installation Guide

What are helm plugins?

Helm plugins are external tools or scripts that integrate seamlessly with Helm, enhancing its functionality and providing extra commands or features. These plugins are designed to simplify complex workflows, automate tasks, or introduce entirely new capabilities not covered by Helm’s core functionalities.

Common Helm Plugins:

  1. helm-diff: Displays the difference between Helm releases, providing a visual representation of changes before applying updates.
  2. helm-secrets: Manages encrypted secrets within Helm charts, enhancing security and enabling secure storage of sensitive information.
  3. helm-nuke: Deletes and purges all releases stored by Helm.
  4. helm-git: Allows Helm charts to be installed directly from Git repositories, simplifying the deployment of charts stored in version control.

Use cases of helm plugins

  1. Visualization of Changes:
    • Use Case: The helm-diff plugin is used to visualize changes before applying updates to Helm releases.
    • Benefit: Users can preview the differences between the current release and proposed changes, reducing the risk of unintended modifications and ensuring a clearer understanding of the impact of updates.
  2. Managing Encrypted Secrets:
    • Use Case: The helm-secrets plugin is employed for managing encrypted secrets within Helm charts.
    • Benefit: Enhances security by allowing the secure storage and deployment of sensitive information within Helm releases. Encrypted secrets mitigate the risk of exposing confidential data during the deployment process.
  3. Version Control Integration:
    • Use Case: The helm-git plugin facilitates the installation of Helm charts directly from Git repositories.
    • Benefit: Simplifies deployment workflows by enabling Helm charts to be sourced directly from version control. This promotes consistency, traceability, and reproducibility in deployments.
  4. Custom Workflow Automation:
    • Use Case: Helm plugins created for automating custom workflows or tasks specific to an organization or application.
    • Benefit: Provides a tailored solution to automate repetitive tasks, reducing manual intervention and ensuring consistency in deployment processes. Custom workflow automation plugins enhance efficiency and streamline Helm usage based on unique organizational requirements.

Example:

There is one plugin which I found very useful: helm diff plugin

The helm-diff plugin is a popular Helm plugin that provides the capability to visualize the differences between releases before applying updates. It is particularly useful for understanding the changes that will be made to a Kubernetes cluster when a Helm release is upgraded or installed.

First install the helm diff plugin and it can be in single command.

helm plugin install https://github.com/databus23/helm-diff
diff

After installation you can verify if it is installed or not using following command.

helm plugin list
list

Now lets create a helm chart nodeapp, you can give any name to it.

helm create nodeapp
create

then create a helm release ‘mynodeapp’.

helm install mynodeapp nodeapp
install

this is our revision 1.

now lets update the values.yaml file as given below.

open the nodeapp directory

cd nodeapp

now edit the values.yaml using following command.

nano values.yaml

edit it as shown below.

replicaCount: 2

image:
  repository: devopshint/node-app
  pullPolicy: IfNotPresent
  # Overrides the image tag whose default is the chart appVersion.
  tag: "latest"
helm plugins

to save the modification press ctrl+x and shift+y, then press enter.

now exit the directory

cd

Now lets upgrade the release

helm upgrade mynodeapp nodeapp
upgrade

as you can see this is our revision 2.

Now run the helm diff command.

helm diff revision mynodeapp 1 2

Here 1 represents the 1st release (revision) and 2 represents the 2nd release (revision).

Output:

myapp 1

The helm-diff plugin provides a visual representation of the changes that would be applied during a Helm upgrade or install operation. It compares the current state of a release with the desired state specified in the Helm chart, highlighting the differences in a human-readable format. The red color and ‘-‘ sign represents the line or part before change and green color and ‘+’ sign represents the line or part after the change.

After your work is done you can uninstall the plugin

helm plugin uninstall diff
uninstall

Example 2:

There is one more plugin which I found very useful: helm-git plugin

The helm-git plugin is a community-contributed plugin for Helm that facilitates the installation and management of Helm charts directly from Git repositories. It simplifies the process of fetching Helm charts from version control systems like Git, making it convenient for users to deploy applications using Helm from their source repositories.

First install the helm-git plugin

helm plugin install https://github.com/aslafy-z/helm-git
git

Then add Git Repository as a helm chart repository

helm repo add examples https://helm.github.io/examples
gitinstall

Then install the chart from Git

helm install mynodeapp examples/hello-world
gitin

chart is installed successfully

uninstall the plugin

helm plugin uninstall helm-git
gituninstall

Benefits of helm plugins

  1. Extensibility and Customization:
    • Benefit: Helm plugins extend Helm’s core functionality, allowing users to customize and tailor Helm to their specific needs. Users can choose plugins that provide additional features or commands relevant to their workflows, creating a more personalized and efficient Helm experience.
  2. Workflow Streamlining and Automation:
    • Benefit: Helm plugins automate repetitive tasks and streamline workflows, reducing manual intervention and potential errors. This automation accelerates the deployment and management of Kubernetes applications, saving time and improving overall efficiency.
  3. Enhanced Security and Compliance:
    • Benefit: Certain Helm plugins, such as helm-secrets, contribute to enhanced security by providing a mechanism for managing encrypted secrets within Helm charts. Additionally, custom plugins can be developed to perform audit checks or compliance validations, ensuring that Helm deployments adhere to organizational security and compliance standards.
  4. Improved Visualization and Understanding:
    • Benefit: Helm plugins like helm-diff enhance visualization by displaying the differences between Helm releases. This visual representation helps users understand the changes before applying updates, reducing the risk of unintended modifications and providing better insights into the impact of changes.

Conclusion

In conclusion, Helm plugins emerge as powerful tools that elevate the capabilities of Helm, the Kubernetes package manager, allowing for tailored and efficient management of applications. These plugins extend Helm’s functionality, providing solutions for diverse use cases, from visualizing changes to managing encrypted secrets and streamlining workflows.

Related Articles:

How to use ‘_helpers.tpl’ in helm with example [2 steps]

About Prasad Hole

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Share via
Copy link