Introduction to Helm charts

Category : Kubernetes | Sub Category : Kubernetes With Java | By Prasad Bonam Last updated: 2023-11-21 13:30:47 Viewed : 208


Helm is a package manager for Kubernetes that simplifies the deployment and management of applications. Helm uses a packaging format called charts, which are a collection of pre-configured Kubernetes resources. Helm charts allow you to define, install, and upgrade even the most complex Kubernetes applications.

Key Concepts:

  1. Chart:

    • A Helm package is called a chart.
    • Charts are versioned, shareable packages that contain all the Kubernetes resources needed to run an application.
  2. Release:

    • A specific instance of a chart is called a release.
    • Each release is a deployed version of a chart, with its own configuration, resources, and revision history.
  3. Repository:

    • A collection of charts is stored in a Helm repository.
    • Helm charts can be hosted in public or private repositories for easy sharing and distribution.

Helm Chart Structure:

A Helm chart is organized in a directory structure containing the following key files and directories:

  • Chart.yaml:

    • Metadata about the chart, including name, version, and description.
  • values.yaml:

    • Default configuration values for the chart.
    • Users can override these values during installation.
  • templates/:

    • Directory containing Kubernetes resource files written in YAML or Helm`s template language.
    • These files define the resources that will be deployed when the chart is installed.
  • charts/:

    • Directory containing subcharts or dependencies that the main chart relies on.

Helm Commands:

  1. Install a Chart:

    bash
    helm install <release-name> <chart-name>
    • <release-name> is the name you give to the release.
    • <chart-name> is the name or path of the chart.
  2. Upgrade a Release:

    bash
    helm upgrade <release-name> <chart-name>
    • Upgrades an existing release with changes from a new chart.
  3. List Releases:

    bash
    helm list
    • Lists all releases, their statuses, and revision numbers.
  4. Uninstall a Release:

    bash
    helm uninstall <release-name>
    • Removes a release from the cluster.
  5. Show Chart Information:

    bash
    helm show chart <chart-name>
    • Displays information about a chart, including its dependencies.

Example Helm Chart:

Here is a simple Helm chart structure for a basic NGINX deployment:

plaintext
my-nginx-chart/ |-- Chart.yaml |-- values.yaml |-- templates/ | |-- deployment.yaml | |-- service.yaml
  • Chart.yaml contains metadata about the chart.
  • values.yaml contains default configuration values.
  • templates/ contains Kubernetes resource files (e.g., deployment.yaml and service.yaml) written in Helm`s template language.

Helm Repository:

Helm charts can be stored in a repository for easy sharing and distribution. Helm provides commands to manage repositories:

  • Add a Repository:

    bash
    helm repo add <repo-name> <repo-url>
    • Adds a Helm chart repository.
  • Search for Charts:

    bash
    helm search repo <keyword>
    • Searches for charts in the specified repository.
  • Fetch the Latest Charts:

    bash
    helm repo update
    • Updates the local repository cache with the latest available charts.

Helm makes it easy to package, deploy, and manage Kubernetes applications, making it a popular choice for application deployment in Kubernetes clusters.

Search
Related Articles

Leave a Comment: