1.安装helm
添加helm源
helm repo add stable http://mirror.azure.cn/kubernetes/charts/
helm repo add bitnami https://charts.bitnami.com/bitnami
2.下载包到本地,解压后编辑value.yaml后应用
[root@master test]# helm fetch stable/mysql
WARNING: Kubernetes configuration file is group-readable. This is insecure. Location: /root/.kube/config
WARNING: Kubernetes configuration file is world-readable. This is insecure. Location: /root/.kube/config
[root@master test]# ls
mysql mysql-1.6.9.tgz
vi values.yaml
helm install testsql mysql
3.配置更新
helm upgrade -f test.yaml testmysql ./mysql
查看更新
helm get values testmysql
查看历史记录
helm history testmysql
版本回滚
helm rollback testmysql 1
4.Helm管理Chart包
helm create mychart
打包
[root@master testchart]# helm package mychart
WARNING: Kubernetes configuration file is group-readable. This is insecure. Location: /root/.kube/config
WARNING: Kubernetes configuration file is world-readable. This is insecure. Location: /root/.kube/config
Successfully packaged chart and saved it to: /root/test/testchart/mychart-0.1.0.tgz
[root@master testchart]# ls
mychart mychart-0.1.0.tgz
查看是否合法
[root@master testchart]# helm lint mychart
WARNING: Kubernetes configuration file is group-readable. This is insecure. Location: /root/.kube/config
WARNING: Kubernetes configuration file is world-readable. This is insecure. Location: /root/.kube/config
==> Linting mychart
[INFO] Chart.yaml: icon is recommended
1 chart(s) linted, 0 chart(s) failed
部署:
helm install testchart mychart-0.1.0.tgz
上传到制品仓库(harbor或者其他):
测试渲染
helm template mychart-0.1.0.tgz >xuanran.yaml
helm install --generate-name --dry-run --debug ./mychart
cat xuanran.yaml