Helm上传Chart到Artifact Hubchart首先我们创建一个helm-charts文件夹,并且在这个目录下创建一个helm示例,并对他进行打包
helm create helm-sample
helm package helm-sample
创建一个charts文件夹,并将打包后的helm-sample-0.1.0.tgz放到该目录下面
mkdir charts
mv helm-sample-0.1.0.tgz charts
Index索引文件索引文件是一个名为 index.yaml 的 Yaml 文件。它包含有关 Chart 包的一些元数据,包括 Chart.yaml 文件的内容。有效的 Chart Repository 必须具有索引文件。索引文件包含有关 Chart Repository 中每个 Chart 的信息。可以通过 helm repo index 命令将本地目录下的 Chart 生成索引文件。
helm repo index .
然后简单修改一下里面的信息:
apiVersion: v1
entries:
helm-sample:
- apiVersion: v2
appVersion: 1.16.0
created: "2023-11-27T11:32:08.795143+08:00"
description: A Helm chart for Kubernetes
digest: 1ba6d827b6a269434b821a6fa13f52b9a9ce087714e1ce8624b428f2e38aff4c
name: helm-sample
type: application
version: 0.1.0
home: https://lucas234.github.io/helm-charts/
kubeVersion: ^1.10.0-0
keywords:
- helm-sample
- elastic
- vector
- search
- deploy
maintainers:
- email: ly_liubo@163.com
name: lucas
url: https://lucas234.github.io/helm-charts/
sources:
- https://github.com/lucas234/helm-charts
urls:
- https://raw.githubusercontent.com/lucas234/helm-charts/main/charts/helm-sample-0.1.0.tgz
generated: "2023-11-27T11:32:08.793495+08:00"
最后由于CHART REPOSITORY标准,我们需要将index.yaml放到charts下面:
cp index.yaml charts
github仓库首先我们创建一个github仓库:https://github.com/lucas234/helm-charts 然后上传项目到我们的github仓库中。
git init
git add .
git commit -m "add files"
git branch -M main
git remote add origin https://github.com/lucas234/helm-charts
git push origin main
WEB服务这里通过GitHub Pages为Chart Repository提供Web服务。
GitHub Action 允许你以两种不同的方式提供静态网页:
docs/目录的内容我们将采用第二种方法,尽管第一种方法同样简单。 第一步是创建 helm-sample-pages 分支:
git checkout -b helm-sample-pages
git push origin helm-sample-pages
接下来,你将要确保将helm-sample-pages分支设置为GitHub Pages,点击你的repo Settings并点击到Pages,选择branch后点击Save,即可在Github pages下边看到
Your site is live at https://lucas234.github.io/helm-charts/
然后我们打开Artifact Hub的仓库地址:https://artifacthub.io/control-panel/repositories
并进行添加我们的helm-sample, URL选项填入https://lucas234.github.io/helm-charts/ 即可