本文讲述的是调教 Helm 3 和 harbor 1.6+ 的经验,从 helm2 更新到 helm 3 而且将 charts 推送到 harbor 中进行存储,移除了原先的 helm serve,在讲述怎么操做以前先来看一下Helm 3 和 Harbor 1.6+ 的新特性。node
.Capabilities
JSONSchema
验证 charts 的 Valuesrequirements.yaml
合并到Chart.yaml
中--generate-name
参数helm delete
--> helm uninstall
helm inspect
-> helm show
helm fetch
-> helm pull
k8s.io/helm
--> helm.sh/helm
具体新特性能够参考Helm 3 新特性,或者参考Helm 官方文档linux
这里没什么好说的,想要了解更多关于Harbor的,能够参考官方Githubgit
在了解了以上新的特性以后,让我着手来操做吧github
这里就很少说 kubernetes 环境的具体搭建过程了,搭建步骤随处可见。shell
首先执行一下命令,下载并解压安装包api
wget https://get.helm.sh/helm-v2.14.2-linux-amd64.tar.gz
tar zxvf helm-v2.14.2-linux-amd64.tar.gz
cd linux-amd64
cp helm /usr/local/bin
复制代码
解压以后,你若是使用过helm 2 你会发现里面tiller的二进制文件不见了,前文的新特性中已经说了,helm 3 已经移除了 tillerdom
接下来初始化 helm测试
helm init
复制代码
默认添加官方 repo stable https://kubernetes-charts.storage.googleapis.com
fetch
这里我使用的是 harbor 官方提供的 charts repo
,好奇心驱使我打开了这个网站 helm.goharbor.io/网站
这熟悉的界面让我严重怀疑是使用的 helm serve 启的 repo(滑稽脸)
添加harbor repo
helm repo add goharbor https://helm.goharbor.io
复制代码
这个 repo 只有一个charts harbor ,对应的 harbor 版本为1.8.1
在安装以前咱们须要配置一下 kube config context
查看当前的context
kubectl config current-context
复制代码
设置 context 指定对应的 namespace ,不指定使用的是 default
kubectl config set-context <current-context> --namespace test
复制代码
这里是由于,helm 3 开始helm 3 的执行权限和kubectl config 的权限是一致的,经过kubectl config的方式来控制helm 3 的执行权限。
按时安装harbor ,这里为了简化测试操做,我关闭了数据卷的挂载并使用的是 NodePort 方式进行访问。
helm -n test install harbor goharbor/harbor --set persistence.enabled=false --set expose.type=nodePort --set expose.tls.enabled=false --set externalURL=http://192.168.10.196:30002
复制代码
参数说明:
出现如下返回,就证实已经开始安装了
NAME: harbor
LAST DEPLOYED: 2019-07-23 11:00:38.525597536 +0800 CST m=+0.690703892
NAMESPACE: test
STATUS: deployed
NOTES:
Please wait for several minutes for Harbor deployment to complete.
Then you should be able to visit the Harbor portal at https://core.harbor.domain.
For more details, please visit https://github.com/goharbor/harbor.
复制代码
harbor 装好以后,咱们访问 http://192.168.10.196:30002 进行登陆 harbor, harbor 的默认帐号密码是 admin/Harbor12345
新建一个chart repo
建立一个 test 用户
helm repo add test http://192.168.10.76:30002/chartrepo/chart_repo
复制代码
helm plugin install https://github.com/chartmuseum/helm-push
复制代码
这里最好本地配置一下 github 的 dns 地址,否则可能会出现连接超时的现象
安装好插件以后,就能够push charts 到 harbor 里面了
helm push grafana-0.0.2.tgz test --username test --password xxx
复制代码
- Github: github.com/innerpeacez
- 我的Blog: ipzgo.top
- 日拱一卒,不期速成