k8s包管理器helm_kubernetes(30):k8s包管理工具-helm(4)-harbor管理helm-charts

本文档详细介绍了如何使用Harbor作为企业级Docker仓库来托管Helm图表。首先,在安装Harbor时添加Chart Museum组件。然后,通过`helm-push`插件上传Helm图表到Harbor仓库,并将仓库添加到本地Helm的repo列表中。最后,演示了如何搜索、更新和安装托管在Harbor上的Helm图表。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

harbor管理 helm-charts

当我们定义完chart后需要有个地方存储,就像docker的imag,存储到registry。Harbor作为一个企业级的docker仓库,也能存储chart

harbor安装

harbor 安装的时候 默认没有helm charts的仓库

docker-compose stop

./install.sh --with-chartmuseum

安装完成之后登录页面上就会有了 helm charts 了,页面上也可以直接上传charts

在Harbor在创建一个charts项目,用于存储charts如下:

安装helm-push

helm plugin install https://github.com/chartmuseum/helm-push

在Helm Charts标签页下,可以上传我们的chart,注意它需要是使用tar压缩的压缩文件,我试过rar是不可以的。

添加到仓库列表

使用如下命令将我们的harbor仓库chart添加到helmrepo:

helm repo add myrepo https://xx.xx.xx.xx/chartrepo/charts

现在就可以安装了。

[root@k8s-master harbor]# helm repo add myrepo http://10.6.76.25/chartrepo/chart --username admin --password 123456 #harbor用户密码

"myrepo"has been added to your repositories

[root@k8s-master harbor]# helm repo list

NAME URL

stable https://kubernetes.oss-cn-hangzhou.aliyuncs.com/charts

local http://127.0.0.1:8879/charts

myrepo http://10.6.76.25/chartrepo/chart

[root@k8s-master harbor]#

上传

[root@k8s-master ~]# cd helm/[root@k8s-master helm]# lscustom.yaml hello-helm hello-helm-0.1.0.tgz mychart mychart-0.1.0.tgz mychart-0.3.0.tgz mychart-0.4.0.tgz mychart-0.5.0.tgz

[root@k8s-master helm]# helm push hello-helm myrepo

Pushing hello-helm-0.1.0.tgz to myrepo...

Done.

[root@k8s-master helm]# helm push mychart myrepo

Pushing mychart-0.5.0.tgz to myrepo...

Done.

[root@k8s-master helm]#

更新仓库

[root@k8s-master helm]# helm search hello-helm

NAME CHART VERSION APP VERSION DESCRIPTION

local/hello-helm 0.1.0 1.0 A Helm chart forKubernetes

[root@k8s-master helm]# helm repo update

Hang tightwhilewe grab the latest from your chart repositories...

...Skip local chart repository

...Successfully got an update from the"myrepo"chart repository

...Successfully got an update from the"stable"chart repository

Update Complete. ⎈ Happy Helming!⎈

[root@k8s-master helm]# helm search hello-helm

NAME CHART VERSION APP VERSION DESCRIPTION

local/hello-helm 0.1.0 1.0 A Helm chart forKubernetes

myrepo/hello-helm 0.1.0 1.0 A Helm chart forKubernetes

[root@k8s-master helm]#

安装测试

[root@k8s-master helm]# helm list

NAME REVISION UPDATED STATUS CHART APP VERSION NAMESPACE

wx-test 1 Wed Sep 25 14:26:08 2019 DEPLOYED mychart-0.5.0 1.0default

wx-test2 1 Wed Sep 25 14:29:36 2019 DEPLOYED mychart-0.5.0 1.0 kube-system

[root@k8s-master helm]# helm install myrepo/hello-helm --name haha

NAME: haha

LAST DEPLOYED: Wed Sep25 17:27:04 2019NAMESPACE: default

STATUS: DEPLOYED

RESOURCES:==> v1/Deployment

NAME READY UP-TO-DATE AVAILABLE AGE

haha-hello-helm 0/1 1 00s==> v1/Pod(related)

NAME READY STATUS RESTARTS AGE

haha-hello-helm-b7c945776-w7tfb 0/1 ContainerCreating 00s==> v1/Service

NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE

haha-hello-helm NodePort 10.102.153.183 80:31566/TCP 0s

NOTES:1. Get the application URL by running these commands:

export NODE_PORT=$(kubectl get --namespace default -o jsonpath="{.spec.ports[0].nodePort}" services haha-hello-helm)

export NODE_IP=$(kubectl get nodes --namespace default -o jsonpath="{.items[0].status.addresses[0].address}")echo http://$NODE_IP:$NODE_PORT

[root@k8s-master helm]# helm list

NAME REVISION UPDATED STATUS CHART APP VERSION NAMESPACE

haha1 Wed Sep 25 17:27:04 2019 DEPLOYED hello-helm-0.1.0 1.0default

wx-test 1 Wed Sep 25 14:26:08 2019 DEPLOYED mychart-0.5.0 1.0default

wx-test2 1 Wed Sep 25 14:29:36 2019 DEPLOYED mychart-0.5.0 1.0 kube-system

[root@k8s-master helm]#

[root@k8s-master helm]# kubectl get pod,svc| grephaha

pod/haha-hello-helm-b7c945776-w7tfb 1/1 Running 040s

service/haha-hello-helm NodePort 10.102.153.183 80:31566/TCP 40s

[root@k8s-master helm]#

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值