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

harbor管理 helm-charts

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

 

harbor安装

docker(22):dockers企业级私有仓库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添加到helm repo:

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]# ls
custom.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 for Kubernetes
[root@k8s-master helm]# helm repo update
Hang tight while we 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 for Kubernetes
myrepo/hello-helm       0.1.0           1.0             A Helm chart for Kubernetes
[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.0             default
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 Sep 25 17:27:04 2019
NAMESPACE: default
STATUS: DEPLOYED

RESOURCES:
==> v1/Deployment
NAME             READY  UP-TO-DATE  AVAILABLE  AGE
haha-hello-helm  0/1    1           0          0s

==> v1/Pod(related)
NAME                             READY  STATUS             RESTARTS  AGE
haha-hello-helm-b7c945776-w7tfb  0/1    ContainerCreating  0         0s

==> v1/Service
NAME             TYPE      CLUSTER-IP      EXTERNAL-IP  PORT(S)       AGE
haha-hello-helm  NodePort  10.102.153.183  <none>       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
haha            1               Wed Sep 25 17:27:04 2019        DEPLOYED        hello-helm-0.1.0        1.0             default
wx-test         1               Wed Sep 25 14:26:08 2019        DEPLOYED        mychart-0.5.0           1.0             default
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| grep haha

pod/haha-hello-helm-b7c945776-w7tfb           1/1     Running   0          40s
service/haha-hello-helm   NodePort    10.102.153.183   <none>        80:31566/TCP   40s
[root@k8s-master helm]#

 

posted on 2019-10-15 10:51  光阴8023  阅读(467)  评论(0编辑  收藏  举报