Helm chart仓库操作

配置国内存放 chart 仓库的地址


chart图标是存放资源清单的东西,它是存在于远程仓库当中的 

  • 阿里云仓库(https://kubernetes.oss-cn-hangzhou.aliyuncs.com/charts)
  • 官方仓库(https://hub.kubeapps.com/charts/incubator)官方 chart 仓库,国内可能无法访问。
  • 微软仓库(http://mirror.azure.cn/kubernetes/charts/)这个仓库推荐,基本上官网有的 chart 这里都有,国内可能无法访问。
#添加阿里云的 chart 仓库
[root@master ~]# helm repo add aliyun https://kubernetes.oss-cn-hangzhou.aliyuncs.com/charts
"aliyun" has been added to your repositories
#添加 bitnami 的 chart 仓库
[root@xianchaomaster1 ~]# helm repo add bitnami https://charts.bitnami.com/bitnami

#更新 chart 仓库

[root@xianchaomaster1 ~]# helm repo update
#查看配置的 chart 仓库有哪些
[root@xianchaomaster1 ~]# helm repo list

#删除 chart 仓库地址

[root@xianchaomaster1 ~]# helm repo remove aliyun
"aliyun" has been removed from your repositories
#从指定 chart 仓库地址搜索 chart
[root@xianchaomaster1 ~]# helm search repo aliyun

搜索和下载Chart


 #查看阿里云 chart 仓库中的 memcached

[root@master1 ~]# helm search repo aliyun |grep memcached
aliyun/mcrouter 0.1.0 0.36.0 Mcrouter is a
aliyun/memcached 2.0.1 Free & open

#查看 chart 信息

[root@master1 ~]# helm show chart aliyun/memcached
apiVersion: v1
description: Free & open source, high-performance, distributed memory object caching
 system.
home: http://memcached.org/
icon: https://upload.wikimedia.org/wikipedia/en/thumb/2/27/Memcached.svg/1024pxMemcached.svg.png
#下载 chart 包到本地
[root@master1 ~]# helm pull aliyun/memcached
[root@master1 ~]# tar zxvf memcached-2.0.1.tgz
[root@master1 ~]# cd memcached
[root@master1 memcached]# ls
Chart.yaml README.md templates values.yaml
  • Chart.yaml: chart 的基本信息,包括版本名字之类
  • templates: 存放 k8s 的部署资源模板,通过渲染变量得到部署文件
  • values.yaml:存放全局变量,templates 下的文件可以调用
[root@xianchaomaster1 memcached]# cd templates/
[root@xianchaomaster1 templates]# ls
  • _helpers.tpl NOTES.txt pdb.yaml statefulset.yaml svc.yaml
  • _helpers.tpl 存放能够复用的模板
  • NOTES.txt 为用户提供一个关于 chart 部署后使用说明的文件

猜你喜欢

转载自blog.csdn.net/qq_34556414/article/details/125439004