helm的三个核心概念:
helm安装有四种方式:
helm install stable/mysql
helm install mysql-2.3.tgz
helm install mysql/
helm install http://127.0.0.1:8879/charts/mysql
首先查找包,如想要安装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
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
$ 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 --set service.nodePort=31312 gilded-mule stable/minio
helm rollback gilded-mule 1
helm hisotry gilded-mule
helm delete $releaseName
helm list --all
mkdir -p ~/my-repo
nohup helm serve --address 127.0.0.1:8879 --repo-path ~/my-repo &
# 此时会在mys-repo下新建一个index.html文件
helm repo add my-repo http://127.0.0.1:8879
在自己仓库中添加包,更新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 .
helm create my-charts
,修改对应内容helm install . 或 helm install my-charts.tgz
helm inspect chart my-charts
helm inspect values my-charts
helm inspect my-charts
helm template my-charts -f configfile --set a=b
注意: 如果tiller的serviceaccount只有自己namespace的权限,那么charts中的namespaces也需要指定在tiller的namespaces中.
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。