Foreword
helm of three core concepts:
- Chart: chart is the installation package, and like this rpm, deb installation package
- Reporitory: a warehouse, a store Charts package http server after installing the helm, the default configuration of Google official stable repository.
- release:. heml install a chart generated after each installation example of a chart will have a release.
no direct relationship between the release, each with a release revision, corresponding to the release at the helm version management.
helm mounted in four ways:
- From the repository,
helm install stable/mysql
- After packing charts tgz packages,
helm install mysql-2.3.tgz
- From the charts directory after extracting tgz,
helm install mysql/
- From url,
helm install http://127.0.0.1:8879/charts/mysql
helm of daily use:
A release life cycle
-
First find the package, as you want to install MySQL,
helm search mysql
, MySQL is a key, if you define the keywords in chart.yaml file in a chart, you can be searched.$ helm search mysql NAME CHART VERSION APP VERSION DESCRIPTION stable/mysql 1.3.0 5.7.14 Fast, reliable, scalable, and easy to use open-source rel... stable/mysqldump 2.5.0 2.4.1 A Helm chart to help backup MySQL databases using mysqldump stable/prometheus-mysql-exporter 0.5.1 v0.11.0 A Helm chart for prometheus mysql exporter with cloudsqlp... stable/percona 1.1.0 5.7.17 free, fully compatible, enhanced, open source drop-in rep... stable/percona-xtradb-cluster 1.0.0 5.7.19 free, fully compatible, enhanced, open source drop-in rep
-
View the contents of the installation package, helm inspect -h, helm inspect values only exposed to view custom parameters, or directly helm fetch download this installation package to the current directory.
$ helm inspect values stable/mysql ## mysql image version ## ref: https://hub.docker.com/r/library/mysql/tags/ ## image: "mysql" imageTag: "5.7.14" busybox: image: "busybox" tag: "1.29.3" testFramework: image: "dduportal/bats" tag: "0.4.0" ## Specify password for root user ## ## Default: random 10 character string # mysqlRootPassword: testing
- Or directly from a custom installation .helm install, using the values to view
helm template $chartsName
the resource file output K8s, and install the same parameters and use--dry-run --debug
to simulate the installation process and the print configuration information.cat << EOF > config.yaml mariadbUser: user0 mariadbDatabase: user0db EOF helm install stable/mysql -f configure.yaml --set service.nodePort=31313 # 只查看安装过程中的文件,不进行实际安装. helm install stable/mysql -f configure.yaml --set service.nodePort=31313 --debug --dry-run # 输出对应k8s的yaml文件 helm template stable/mysql -f configure.yaml --set service.nodePort=31313
- release after viewing the installation, helm ls, you can see the name of the release, revision version, update time, current status, chart version, app version, namespace.
$ helm ls NAME REVISION UPDATED STATUS CHART APP VERSION NAMESPACE gilded-mule 6 Wed Jul 17 10:31:33 2019 DEPLOYED minio-2.5.0 RELEASE.2019-05-14T23-57-45Z default hopping-rottweiler 1 Wed Jul 17 10:06:06 2019 FAILED minio-2.5.0 RELEASE.2019-05-14T23-57-45Z default modest-tuatara 1 Wed Jul 17 10:09:30 2019 FAILED qujun-2.5.0 RELEASE.2019-05-14T23-57-45Z default
-
Resource Status View release currently installed, helm status $ releaseName.
$ helm status gilded-mule LAST DEPLOYED: Wed Jul 17 10:31:33 2019 NAMESPACE: default STATUS: DEPLOYED RESOURCES: ==> v1/ConfigMap NAME DATA AGE gilded-mule-minio 1 68m ==> v1/PersistentVolumeClaim NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE gilded-mule-minio Pending 68m ==> v1/Pod(related) NAME READY STATUS RESTARTS AGE gilded-mule-minio-84f85fff78-rv6r6 0/1 Pending 0 68m ==> v1/Secret NAME TYPE DATA AGE gilded-mule-minio Opaque 2 68m ...........
-
View release details, heml get $ releasename, view the corresponding file k8s of yaml, helm get manifest $ releaseName. Value.heml get values $ releasename When viewing a custom installation
$ helm get gilded-mule REVISION: 6 RELEASED: Wed Jul 17 10:31:33 2019 CHART: minio-2.5.0 USER-SUPPLIED VALUES: service: nodePort: 31312 COMPUTED VALUES: DeploymentUpdate: maxSurge: 100% maxUnavailable: 0 type: RollingUpdate StatefulSetUpdate: updateStrategy: RollingUpdate ...... # 查看这个release安装时自定义的参数. $ helm get values gilded-mule service: nodePort: 31312
- Upgrade, rollback, see the imprint, helm upgrade, helm rollback, helm hisotry
helm upgrade --set service.nodePort=31312 gilded-mule stable/minio helm rollback gilded-mule 1 helm hisotry gilded-mule
- delete
helm delete $releaseName helm list --all
repository of use
- View the current warehouse, helm repo list
- Create your own warehouse in the machine
mkdir -p ~/my-repo nohup helm serve --address 127.0.0.1:8879 --repo-path ~/my-repo & # 此时会在mys-repo下新建一个index.html文件
- Add your own warehouse
helm repo add my-repo http://127.0.0.1:8879
-
Add your own package repository, update index
# 先去github上下载charts cp -r mysql ~/my-repo cd ~/my-repo helm package mysql --save=false helm repo index --url=http://127.0.0.1:8879 .
- Update the repository cache, helm update
Create your own charts
- Quickly create templates
helm create my-charts
, modify the corresponding content - Packing, and then copied to the repository directory, and then perform the update index operation. Helm package
- installation,
helm install . 或 helm install my-charts.tgz
- Verify charts format, helm lint
- View charts contents of the file.
helm inspect chart my-charts
- View value content files.
helm inspect values my-charts
- View charts directory contents of the file.
helm inspect my-charts
- View charts template rendering of yaml after k8s,
helm template my-charts -f configfile --set a=b
Note: If the tiller of serviceaccount only their own namespace permissions, then the charts in namespaces also need to specify the namespaces tiller.