1 3 - Helm
Tomislav Kopić edited this page 2024-05-20 09:51:15 +00:00

Basic Usage of Helm

Helm is a package manager for Kubernetes that helps you manage Kubernetes applications. It allows you to define, install, and upgrade complex Kubernetes applications easily. This guide covers some basic usage of Helm, including adding a repository from Artifact Hub, exporting values to a file, editing values, and deploying a chart to Kubernetes.

Adding a Repository from Artifact Hub

  1. Search for a Chart: Visit Artifact Hub and search for the chart you want to add to your Helm repository.

  2. Add Repository: Once you've found the chart, navigate to its page and copy the repository URL.

  3. Add Repository to Helm: Use the following command to add the repository to Helm:

    helm repo add <repo-name> <repo-url>
    

    Replace <repo-name> with the name you want to give to the repository and <repo-url> with the URL you copied from Artifact Hub.

  4. Update Repositories: After adding the repository, it's a good practice to update your local repository cache with the following command:

    helm repo update
    

Exporting Values to a File

When deploying a Helm chart, you may want to customize values. You can export these values to a file for easier management.

  1. Inspect Chart Values: Use the following command to inspect the default values of a chart:

    helm show values <chart-name>
    

    Replace <chart-name> with the name of the chart you want to inspect.

  2. Export Values: Once you identify the values you want to customize, export them to a file using the following command:

    helm show values <chart-name> > values.yaml
    

    This command redirects the output of the helm show values command to a file named values.yaml. You can then edit this file to customize the values.


Editing Values

After exporting values to a file, you can edit them according to your requirements.

  1. Open Values File: Use a NeoVim to open the values.yaml file you exported in the previous step.

  2. Modify Values: Edit the values in the file according to your needs. You can change settings such as resource limits, environment variables, or any other configurable options provided by the chart.

  3. Save Changes: Save the changes you made to the values.yaml file.


Deploying a Chart to Kubernetes

Once you've added a repository, exported and edited values, you're ready to deploy the chart to Kubernetes.

  1. Install Chart: Use the following command to install the chart to your Kubernetes cluster:

    helm install <release-name> <chart-name> -f values.yaml
    

    Replace <release-name> with the name you want to give to the release and <chart-name> with the name of the chart you want to install. Use the -f flag to specify the values file you edited.

  2. Verify Deployment: After installation, verify that the chart has been deployed successfully by running:

    helm list
    

    This command will list all the releases deployed in your Kubernetes cluster.

  3. Upgrade or Rollback: You can upgrade or rollback releases using Helm commands to manage the lifecycle of your application as needed.