helm 搭建私有chart库

本文介绍helm自建私有仓库,私有创库是通过nginx实现的
在网站根目录创建一个charts目录,专门存放helm打包的压缩包

打包package
#创建一个临时测试目录
mkdir helmtest
cd helmtest
#创建测试图表
[root@master helmtest]# helm create mychart
Creating mychart
#打包,会生成一个tgz包
[root@master helmtest]# helm package mychart
Successfully packaged chart and saved it to: /helmtest/mychart-0.1.0.tgz
#查看下目录的文件 多了一个.tgz包
[root@master helmtest]# ls
mychart  mychart-0.1.0.tgz
#创建一个目录保存.tgz文件
[root@master helmtest]# mkdir myrepo
[root@master helmtest]# mv mychart-0.1.0.tgz myrepo/
执行helm repo index生成库的index文件
#生成index.yaml
[root@master helmtest]# helm repo index myrepo/ --url http://127.0.0.1/charts
#查看是否生成
[root@master helmtest]# ls myrepo/
index.yaml  mychart-0.1.0.tgz
#进入到myrepo目录
[root@master helmtest]# cd myrepo
#将生成的index.yaml文件及charts包复制到nginx的charts目录下面
[root@master myrepo]# cp * /home/wwwroot/default/charts/
通过helm repo add 将新仓库添加到helm
[root@master helmtest]# helm repo add myrepo http://127.0.0.1/charts
"myrepo" has been added to your repositories
#查看刚提交的chart
[root@master helmtest]# helm search repo myrepo
NAME            CHART VERSION   APP VERSION DESCRIPTION                
myrepo/mychart  0.1.0           1.16.0      A Helm chart for Kubernetes
查看仓库列表
[root@master helmtest]# helm repo list
NAME        URL                                                       
stable      https://kubernetes-charts.storage.googleapis.com          
incubator   https://kubernetes-charts-incubator.storage.googleapis.com
bitnami     https://charts.bitnami.com/bitnami                        
aliyuncs    https://apphub.aliyuncs.com                               
myrepo      http://127.0.0.1/charts

私有创库搭建完毕

你可能感兴趣的:(helm 搭建私有chart库)