首先查找包,如想要安装mysql,helm search mysql,mysql是个关键字,如果一个chart中的chart.yaml文件内定义了这个关键字,则可以被搜索到.
$ 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
查看安装包的内容,helm inspect -h, helm inspect values 只查看暴露的自定义参数, 或者直接helm fetch下载此安装包至当前目录.
$ 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
根据查看到的values来自定义安装或直接安装.helm install, 使用helm template $chartsName输出K8s的资源文件,参数与install一样.使用--dry-run --debug来模拟安装过程并打印配置信息.
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, helm ls, 可以查看release的名字,revision版本,更新时间,当前状态,chart版本,app版本,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
查看release当前安装的资源状态,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
...........
查看release详细信息,heml get $releasename, 查看对应k8s的yaml文件, helm get manifest $releaseName.查看安装时自定义的value.heml get values $releasename
$ 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
升级,回退,查看版本记录,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
删除
helm delete $releaseName
helm list --all