本文讲述的是调教 helm 3 和 harbor 1.6+ 的经验,从 helm2 更新到 helm 3 并且将 charts 推送到 harbor 中进行存储,移除了原先的 helm serve,在讲述怎么操作之前先来看一下helm 3 和 harbor 1.6+ 的新特性。
.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 官方文档
这里没什么好说的,想要了解更多关于harbor的,可以参考官方github
在了解了以上新的特性之后,让我着手来操作吧
这里就不多说 kubernetes 环境的具体搭建过程了,搭建步骤随处可见。
首先执行一下命令,下载并解压安装包
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 已经移除了 tiller
接下来初始化 helm
helm init
默认添加官方 repo stable https://kubernetes-charts.storage.googleapis.com
这里我使用的是 harbor 官方提供的 charts repo
,好奇心驱使我打开了这个网站
这熟悉的界面让我严重怀疑是使用的 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 装好之后,我们访问 进行登录 harbor, harbor 的默认账号密码是 admin/harbor12345
新建一个chart repo
创建一个 test 用户
添加 repo 到 helm 中
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
出现以上就说明 push 成功了 ,恭喜!!!
- github:
- 个人blog:
- 日拱一卒,不期速成
如对本文有疑问, 点击进行留言回复!!
linux下文本编辑器vim的使用方法(复制、粘贴、替换、行号、撤销、多文件操作)
网友评论