Github开源生信云平台 DEMO
执行:
helm repo add traefik https://traefik.github.io/charts
只是添加 Helm 仓库地址到本地 Helm 配置,不会安装 Traefik。Traefik 官方 Helm Chart 仓库就是这个地址。(Traefik)
可以通过下面几个命令查看。
helm repo list
输出类似:
NAME URL traefik https://traefik.github.io/charts
说明仓库已经添加。
建议执行:
helm repo update
类似:
Hang tight while we grab the latest from your chart repositories... ...Successfully got an update from the "traefik" chart repository Update Complete.
helm search repo traefik
例如:
NAME CHART VERSION APP VERSION traefik/traefik 37.x.x v3.x.x
其中:
traefik/traefik
CHART VERSION
APP VERSION
官方安装方式也是:
helm install traefik traefik/traefik
(GitHub)
helm show chart traefik/traefik
apiVersion: v2 name: traefik version: 37.0.0 appVersion: v3.5.0 description: A Traefik based Kubernetes ingress controller
这个非常重要,安装前一般先看:
helm show values traefik/traefik
或者保存:
helm show values traefik/traefik > values.yaml
然后修改:
deployment: replicas: 2 service: type: LoadBalancer
安装:
helm install traefik traefik/traefik \ -f values.yaml \ -n traefik \ --create-namespace
Helm repo 添加后,索引文件一般在:
~/.cache/helm/repository/
ls ~/.cache/helm/repository/
可能看到:
traefik-index.yaml
里面就是 Chart 列表。
下载 Chart:
helm pull traefik/traefik --untar
得到:
traefik/ ├── Chart.yaml ├── values.yaml └── templates/ ├── deployment.yaml ├── service.yaml ├── serviceaccount.yaml ├── clusterrole.yaml ├── clusterrolebinding.yaml └── ...
这就是 Helm 最终生成 Kubernetes YAML 的来源。
非常适合学习:
helm template traefik traefik/traefik
apiVersion: apps/v1 kind: Deployment metadata: name: traefik --- apiVersion: v1 kind: Service metadata: name: traefik --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole ...
也就是说:
helm repo add | v 添加 Chart 来源 helm search repo | v 找到 Chart helm install | v 读取 templates/*.yaml | v 渲染 values.yaml | v kubectl apply 到 Kubernetes API Server
这也是你前面问的 "https://traefik.github.io/charts 如何解析到 deployment.yaml" 的过程:Helm 并不是直接访问 deployment.yaml,而是下载 Chart 压缩包,其中包含 templates/deployment.yaml 模板,然后根据 values.yaml 渲染成最终 Kubernetes Manifest。(GitHub)
deployment.yaml
templates/deployment.yaml
values.yaml