How to Pull and Push Helm Charts

Introduction

Helm facilitates Kubernetes application deployment and management by introducing the Helm chart, a collection of YAML files describing a related Kubernetes resource set.

Helm charts are stored in chart repositories that are hosted in container registries, either on a local system or online.

In this tutorial, you will learn how to push and pull Helm charts to container registries.

How to Pull and Push Helm Charts

Prerequisites

Note: If you are unsure which version of Helm is running on your system, use the helm version command to find out.

How to Push a Helm Chart to Registry

Helm 3 supports storing and sharing across Open Container Initiative (OCI) registries. However, the support is still considered experimental, and you need to enable it by setting HELM_EXPERIMENTAL_OCI variable to 1.

To do so, type the following in the command line:

export HELM_EXPERIMENTAL_OCI=1

If properly issued, the command returns no output.

1. Create an Example Chart

Create an example Helm chart to make it easier to follow the tutorial.

  1. First, create a directory for the chart:
mkdir helm-testing

2. Next, move into the directory:

cd helm-testing

3. Use the helm create command to generate a simple Helm chart:

helm create test-chart
Creating a test chart in Helm 3.

4. Navigate to the templates directory of the newly created chart:

cd test-chart/templates

5. Remove the contents of the directory:

rm -rf *

6. While in the directory, use a text editor to create a file named configmap.yaml:

nano configmap.yaml

7. Copy the following contents into the file:

apiVersion: v1
kind: ConfigMap
metadata:
  name: test-chart-configmap
data:
  myvalue: "This is a test chart"

8. Save and exit the file.

2. Save and Authenticate

  1. Use the cd .. command to navigate back to the main chart directory. Now save the chart locally:
helm chart save . test-chart:v1
Saving a Helm chart locally using the helm chart save command.

2. Also, create a chart alias containing the registry URI. The example uses a registry set up for test purposes at localhost:5000:

helm chart save . localhost:5000/helm/test-chart:0.1.0
Saving a chart alias containing the registry URI using the helm chart save command.

3. List available charts to confirm the success of the previous two steps:

helm chart list
Using the helm chart list command to see all the charts available locally.

The output shows the saved charts.

4. Now login into the registry using your credentials.

helm registry login -u [username] [registry]
Logging into the container registry using the helm registry login command.

The system prompts you for a password. Type the password and press Enter.

3. Push the Chart to Registry

Use the following command to push your Helm chart to the registry:

helm chart push localhost:5000/helm/test-chart:0.1.0
Pushing the Helm chart to a registry using the helm chart push command.

The output confirms the successful push action and provides additional information about the chart.

Note: To learn the basics of repository management in Helm, read How to Add, Update or Remove a Helm Repo.

How to Pull a Helm Chart

Once you pushed the chart to the registry, you can remove the local version by typing:

helm chart remove localhost:5000/helm/test-chart:0.1.0

Helm removes the chart from the local storage.

Removing the local version of the Helm chart after pushing it to the registry.

To install the chart, pull it from the registry with the helm chart pull command:

helm chart pull localhost:5000/helm/test-chart:0.1.0
Pulling a Helm chart from the registry using the helm chart pull command.

The output confirms that the chart has been downloaded. Export it to a directory by using the export sub-command and the --destination flag:

helm chart export localhost:5000/helm/test-chart:0.1.0 \
--destination ./install
Exporting the Helm chart to a directory on a local file system using the helm chart export command and the --destination flag.

As the screenshot above shows, the chart is now exported to the install directory and you can proceed to install it. For more information about the installation process, refer to How to Use the helm install Command.

Conclusion

This tutorial demonstrated Helm 3 commands for creating, saving, pushing, and pulling Helm charts. For more Helm commands designed to manage and deploy charts, read Helm Commands Cheat Sheet.

Was this article helpful?
YesNo
Marko Aleksic
Marko Aleksić is a Technical Writer at phoenixNAP. His innate curiosity regarding all things IT, combined with over a decade long background in writing, teaching and working in IT-related fields, led him to technical writing, where he has an opportunity to employ his skills and make technology less daunting to everyone.
Next you should read
Helm Commands Cheat Sheet
March 25, 2021

This tutorial covers all important Helm operations and provides examples to help you understand its syntax and features.
Read more
How to Use the helm install Command
June 10, 2021

This tutorial teaches you how to use helm install, the Helm command for installation of charts in a Kubernetes cluster.
Read more
How To Create A Helm Chart
November 14, 2024

Helm charts use a template approach to deploy applications. This article provides step-by-step instructions to create and deploy a Helm chart.
Read more
Helm vs Kustomize: Head-to-Head Comparison
May 27, 2021

Kubernetes natively offers tools to manage application deployment. However, while applying raw YAML...
Read more