第 3 章 Helm CLI


3.1.1. Understanding Helm

Helm is a software package manager that simplifies deployment of applications and services to OpenShift Container Platform clusters.

Helm uses a packaging format called charts. A Helm chart is a collection of files that describes the OpenShift Container Platform resources.

A running instance of the chart in a cluster is called a release. A new release is created every time a chart is installed on the cluster.

Each time a chart is installed, or a release is upgraded or rolled back, an incremental revision is created.

3.1.1.1. Key features

Helm provides the ability to:

  • Search through a large collection of charts stored in the chart repository.
  • Modify existing charts.
  • Create your own charts with OpenShift Container Platform or Kubernetes resources.
  • Package and share your applications as charts.

3.1.2. Installing Helm

The following section describes how to install Helm on different platforms using the CLI.

You can also find the URL to the latest binaries from the OpenShift Container Platform web console by clicking the ? icon in the upper-right corner and selecting Command Line Tools.

Prerequisites

  • You have installed Go, version 1.13 or higher.

3.1.2.1. On Linux

  1. Download the Helm binary and add it to your path:

    # curl -L https://mirror.openshift.com/pub/openshift-v4/clients/helm/latest/helm-linux-amd64 -o /usr/local/bin/helm
    Copy to Clipboard Toggle word wrap
  2. Make the binary file executable:

    # chmod +x /usr/local/bin/helm
    Copy to Clipboard Toggle word wrap
  3. Check the installed version:

    $ helm version
    Copy to Clipboard Toggle word wrap

    Example output

    version.BuildInfo{Version:"v3.0", GitCommit:"b31719aab7963acf4887a1c1e6d5e53378e34d93", GitTreeState:"clean", GoVersion:"go1.13.4"}
    Copy to Clipboard Toggle word wrap

3.1.2.2. On Windows 7/8

  1. Download the latest .exe file and put in a directory of your preference.
  2. Right click Start and click Control Panel.
  3. Select System and Security and then click System.
  4. From the menu on the left, select Advanced systems settings and click Environment Variables at the bottom.
  5. Select Path from the Variable section and click Edit.
  6. Click New and type the path to the folder with the .exe file into the field or click Browse and select the directory, and click OK.

3.1.2.3. On Windows 10

  1. Download the latest .exe file and put in a directory of your preference.
  2. Click Search and type env or environment.
  3. Select Edit environment variables for your account.
  4. Select Path from the Variable section and click Edit.
  5. Click New and type the path to the directory with the exe file into the field or click Browse and select the directory, and click OK.

3.1.2.4. On MacOS

  1. Download the Helm binary and add it to your path:

    # curl -L https://mirror.openshift.com/pub/openshift-v4/clients/helm/latest/helm-darwin-amd64 -o /usr/local/bin/helm
    Copy to Clipboard Toggle word wrap
  2. Make the binary file executable:

    # chmod +x /usr/local/bin/helm
    Copy to Clipboard Toggle word wrap
  3. Check the installed version:

    $ helm version
    Copy to Clipboard Toggle word wrap

    Example output

    version.BuildInfo{Version:"v3.0", GitCommit:"b31719aab7963acf4887a1c1e6d5e53378e34d93", GitTreeState:"clean", GoVersion:"go1.13.4"}
    Copy to Clipboard Toggle word wrap

Prerequisites

  • You have a running OpenShift Container Platform cluster and you have logged into it.
  • You have installed Helm.

Procedure

  1. Create a new project:

    $ oc new-project mysql
    Copy to Clipboard Toggle word wrap
  2. Add a repository of Helm charts to your local Helm client:

    $ helm repo add stable https://kubernetes-charts.storage.googleapis.com/
    Copy to Clipboard Toggle word wrap

    Example output

    "stable" has been added to your repositories
    Copy to Clipboard Toggle word wrap

  3. Update the repository:

    $ helm repo update
    Copy to Clipboard Toggle word wrap
  4. Install an example MySQL chart:

    $ helm install example-mysql stable/mysql
    Copy to Clipboard Toggle word wrap
  5. Verify that the chart has installed successfully:

    $ helm list
    Copy to Clipboard Toggle word wrap

    Example output

    NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
    example-mysql mysql 1 2019-12-05 15:06:51.379134163 -0500 EST deployed mysql-1.5.0 5.7.27
    Copy to Clipboard Toggle word wrap

Procedure

  1. Create a new project:

    $ oc new-project nodejs-ex-k
    Copy to Clipboard Toggle word wrap
  2. Download an example Node.js chart that contains OpenShift Container Platform objects:

    $ git clone https://github.com/redhat-developer/redhat-helm-charts
    Copy to Clipboard Toggle word wrap
  3. Go to the directory with the sample chart:

    $ cd redhat-helm-charts/alpha/nodejs-ex-k/
    Copy to Clipboard Toggle word wrap
  4. Edit the Chart.yaml file and add a description of your chart:

    apiVersion: v2 
    1
    
    name: nodejs-ex-k 
    2
    
    description: A Helm chart for OpenShift 
    3
    
    icon: https://static.redhat.com/libs/redhat/brand-assets/latest/corp/logo.svg 
    4
    Copy to Clipboard Toggle word wrap
    1
    The chart API version. It should be v2 for Helm charts that require at least Helm 3.
    2
    The name of your chart.
    3
    The description of your chart.
    4
    The URL to an image to be used as an icon.
  5. Verify that the chart is formatted properly:

    $ helm lint
    Copy to Clipboard Toggle word wrap

    Example output

    [INFO] Chart.yaml: icon is recommended
    
    1 chart(s) linted, 0 chart(s) failed
    Copy to Clipboard Toggle word wrap

  6. Navigate to the previous directory level:

    $ cd ..
    Copy to Clipboard Toggle word wrap
  7. Install the chart:

    $ helm install nodejs-chart nodejs-ex-k
    Copy to Clipboard Toggle word wrap
  8. Verify that the chart has installed successfully:

    $ helm list
    Copy to Clipboard Toggle word wrap

    Example output

    NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
    nodejs-chart nodejs-ex-k 1 2019-12-05 15:06:51.379134163 -0500 EST deployed nodejs-0.1.0  1.16.0
    Copy to Clipboard Toggle word wrap

返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2025 Red Hat