1. Install and configure the helm

  1. Helm Installation and Configuration
  • The installation

Helm download address: github.com/helm/helm/r… Version 3.5.2: get.helm.sh/helm-v3.5.2…

$tar xf helm-v3.1.0-linux-amd64.tar.gz $cp -a linux-amd64/helm /usr/local/bin $helm version #Copy the code
  • Configuring the Chart repository

Microsoft warehouse: mirror. Azure. Cn/kubernetes /… Basically all the charts on the official website are available here; Ali: cloud warehouse kubernetes.oss-cn-hangzhou.aliyuncs.com/charts

$ helm repo add stable http://mirror.azure.cn/kubernetes/charts $ helm repo add ali https://kubernetes.oss-cn-hangzhou.aliyuncs.com/charts $helm repo list # verify whether the NAME add URL stable http://mirror.azure.cn/kubernetes/charts/ ali https://kubernetes.oss-cn-hangzhou.aliyuncs.com/charts $ helm repo remove Ali # Removes chart repositories that are not currently neededCopy the code
  • The basic concept
    • Chart represents the Helm package and contains all resource definitions needed by the Kubernetes cluster to run an application, tool, or service
    • Repository A place where charts are stored and shared
    • Release is an instance of Chart running in a Kubernetes cluster
    • Chart file structure

Chart.yaml describes the basic information of this Chart, The templates directory contains all the yamL template files value.yaml is used to store the charts of variable values used by templates files The directory holds the other child charts that the current chart depends on

2. Basic commands

  • Find the relevant chart
    • Helm Search can be searched from two sources
    • Helm Search Hub # Find and list Helm Charts from Artifact Hub, which houses a large number of different warehouses
    • Helm Search Repo # Searches from warehouses added to the local HELM client, based on local data, without Internet connection
$ helm search repo              或
$ helm search repo mysql        或
$ helm search repo |grep mysql
Copy the code

Note: Helm search uses a fuzzy string matching algorithm, so you can enter only part of the name

  • View the details of the specific chart
$ helm show chart stable/mysql
Copy the code
  • Install the chart
$helm repo update # Make sure to get the latest chart list $helm install mytomcat stable/tomcat # install or $helm install stable/tomcat -- generation-name # automatically generate release $helm status mytomcat # $helm status mytomcatCopy the code

Releases under different namespaces can have the same name

  • Customize Chart configuration options to install Chart

If we do not use chart’s default configuration options, we need to customize Chart to specify the configuration we want

$helm show values stable/mariadb # View the configurable options in chartCopy the code

There are two ways to pass configuration data: –value or -f specifies YAML files with overrides such as:helm install mytomcat -f config.yaml stable/tomcat–set command line comparison of specified alternative formats:

  • Uninstall the release
$helm uninstall mytomcat #releaseCopy the code
  • Pull the Chart package locally
$helm pull stable/tomcat --untar #Copy the code
  • Build your own Helm Chart deployment — packaged
$helm Create Demo Creating demo $tree ├── Charts ├── Dials │ ├─ $helm Create Demo Creating Demo $tree ├── Charts ├── Dials │ ├── _helpers. TPL │ ├ ─ ─ ingress. Yaml │ ├ ─ ─ the TXT │ ├ ─ ─ serviceaccount. Yaml │ ├ ─ ─ service. The yaml │ └ ─ ─ tests │ └ ─ ─ ├ -connection.yaml ├ ─ values. Yaml 3 directories, 9 files $helm install Web demo/ #Copy the code
  • Push chart to warehouse

1) Install the ChartMuseum warehouse

$helm install Stable /chartmuseum --set env.open.disable_api =false The default upload port will be disabled; otherwise, a 404 error will occurCopy the code

Reference: stackoverflow.com/questions/4…

$helm repo add ChartMuseum http://10.3.254.125:8080 # Add chart repositoryCopy the code

2) Download the helm-Push plug-in

$helm plugin install https://github.com/chartmuseum/helm-push.git # helm plug-in installationCopy the code

Reference: github.com/chartmuseum…

3) Push chart to the Warehouse of ChartMuseum

$helm push tomcat-0.4.3. TGZ Chartmuseum Pushing tomcat-0.4.3. TGZ to Chartmuseum Pushing tomcat-0.4.3. Done.Copy the code