
Helm上传Chart到Artifact Hub
前言
Artifact Hub(工件中心)是一个基于 web 的应用程序,支持查找、安装和发布 CNCF 项目的包和配置。例如,这可能包括 Helm chart、Falco 配置、OPA(Open Policy Agent)策略和 OLM 操作器(operator)。
实践
创建示例chart
首先我们创建一个helmexample
文件夹,并且在这个目录下打开命令窗口创建一个helm
示例,并对他进行打包。
helm create helmexample
helm package helmexample
创建一个打包好的charts
文件夹,并将打包后的helmexample-0.1.0.tgz
放到该目录下面。
mv helmexample-0.1.0.tgz charts
创建github仓库
首先我们创建一个github仓库:https://github.com/AiDaShi/helmexample.git
然后在我们的目录下面执行并上传项目到我们的github仓库中。
echo "# helmexample" >> README.md
git init
git add .
git commit -m "first commit"
git branch -M main
git remote add origin https://github.com/AiDaShi/helmexample.git
git push -u origin main
创建Index索引文件
索引文件是一个名为 index.yaml
的 Yaml 文件。它包含有关 Chart 包的一些元数据,包括 Chart.yaml
文件的内容。有效的 Chart Repository 必须具有索引文件。索引文件包含有关 Chart Repository 中每个 Chart 的信息。可以通过 helm repo index 命令将本地目录下的 Chart 生成索引文件。
helm repo index .
然后我们简单修改一下里面的信息.
apiVersion: v1
entries:
helmexample:
- apiVersion: v1
appVersion: 1.16.0
created: "2023-01-06T11:08:11.0881776+08:00"
description: A Helm chart for Kubernetes
digest: 67d87c187eec57afb3771dcc5d541a5908fa3c75e0ec32318111dac691cd008b
name: helmexample
type: application
version: 0.1.0
home: https://aidashi.github.io/helmexample
icon: https://img.tnblog.net/userdata/heads/a011e63c901a433e847b6f0d3dbe1a2f.jpeg
kubeVersion: ^1.10.0-0
keywords:
- helmexample
- elastic
- vector
- search
- deploy
maintainers:
- email: 86382516@qq.com
name: bob
url: https://aidashi.github.io/helmexample
sources:
- https://github.com/AiDaShi/helmexample
urls:
- https://github.com/AiDaShi/helmexample/raw/main/charts/helmexample-0.1.0.tgz
generated: "2023-01-06T11:08:11.0851748+08:00"
最后由于CHART REPOSITORY标准,我们需要将index.yaml
放cp
到charts
下面。
cp index.yaml charts
创建 CHART REPOSITORY
Chart Repository是需要一个HTTP服务器进行管理,其容纳了一个 index.yaml 和 任意个已归档的 Chart 包。当你准备共享 Chart 时,首选的方法是将其上传到 Chart Repository 中。
托管 Chart Repository 需要有一台可以响应 GET 请求的HTTP服务器,因此当你托管自己的 Chart Repository 你可以有很多选择。例如,你可以使用 Google Cloud Storage(GCS)存储,Amazon S3存储,GitHub Pages,甚至可以自己创建 Web 服务器。
CHART REPOSITORY 组织结构
index.yaml 描述 Chart Repository 中所有 Chart 的索引。通常,index.yaml 文件以及 provenance files 存放在同一台服务器上。
例如,存储库的布局 https://example.com/charts 可能如下所示
创建 WEB 服务
这里通过 GitHub Pages 为 Chart Repository 提供 Web 服务。
GitHub Action 允许你以两种不同的方式提供静态网页:
1.通过配置项目以提供其 docs/
目录的内容
2.通过配置项目以提供特定分支的内容
我们将采用第二种方法,尽管第一种方法同样简单。
第一步是创建 helmexample-pages
分支。
git checkout -b helmexample-pages
# 同步远程分支
git push -u origin helmexample-pages
接下来,你将要确保将 helmexample-pages 分支设置为 GitHub Pages,点击你的repo Setting
并滚动到 GitHub pages 单元,如下图设置:
选择自定义分支并我们的helmexample-pages
分支后点击保存,然后我们自定义域名。
这里我就设置为:aidashi-helmexample.github.io/helmexample
。
访问我们的连接看看,是没问题的。
然后我们打开Artifact Hub的仓库地址:https://artifacthub.io/control-panel/repositories
并进行添加我们的helmexample
(Display name 后面我没有填写)
然后我们搜索我们的helmexample chart
然后我们找到右上角的install
安装,可以显示安装命令。
部署
然后我们在集群中执行简单的部署。
helm repo add helmexample https://aidashi.github.io/helmexample/
helm install my-helmexample helmexample/helmexample --version 0.1.0
最后查看部署情况。
kubectl get all
欢迎加群讨论技术,1群:677373950(满了,可以加,但通过不了),2群:656732739


默认昵称
mac地址会更改但vxlan解析后mac地址除了源mac地址改为cni0的地址外目的mac是c3 pod的mac. 这里的源地址是被改为flannel.1的mac地址吧 ,你这里写的是cni0的地址