1 功能
该命令由于chart仓库交互的多条子命令组成,用来添加、列出、删除、更新和索引chart仓库。
2 参数
helm repo -h
This command consists of multiple subcommands to interact with chart repositories.
It can be used to add, remove, list, and index chart repositories.
Usage:
helm repo [command]
Available Commands:
add add a chart repository
index generate an index file given a directory containing packaged charts
list list chart repositories
remove remove a chart repository
update update information of available charts locally from chart repositories
Flags:
-h, --help help for repo
Global Flags:
--add-dir-header If true, adds the file directory to the header
--alsologtostderr log to standard error as well as files
--debug enable verbose output
--kube-context string name of the kubeconfig context to use
--kubeconfig string path to the kubeconfig file
--log-backtrace-at traceLocation when logging hits line file:N, emit a stack trace (default :0)
--log-dir string If non-empty, write log files in this directory
--log-file string If non-empty, use this log file
--log-file-max-size uint Defines the maximum size a log file can grow to. Unit is megabytes. If the value is 0, the maximum file size is unlimited. (default 1800)
--logtostderr log to standard error instead of files (default true)
-n, --namespace string namespace scope for this request
--registry-config string path to the registry config file (default "/root/.config/helm/registry.json")
--repository-cache string path to the file containing cached repository indexes (default "/root/.cache/helm/repository")
--repository-config string path to the file containing repository names and URLs (default "/root/.config/helm/repositories.yaml")
--skip-headers If true, avoid header prefixes in the log messages
--skip-log-headers If true, avoid headers when opening log files
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)
-v, --v Level number for the log level verbosity
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
Use "helm repo [command] --help" for more information about a command.
3 从父命令继承的命令
--debug enable verbose output
--kube-apiserver string the address and the port for the Kubernetes API server
--kube-as-group stringArray group to impersonate for the operation, this flag can be repeated to specify multiple groups.
--kube-as-user string username to impersonate for the operation
--kube-ca-file string the certificate authority file for the Kubernetes API server connection
--kube-context string name of the kubeconfig context to use
--kube-token string bearer token used for authentication
--kubeconfig string path to the kubeconfig file
-n, --namespace string namespace scope for this request
--registry-config string path to the registry config file (default "~/.config/helm/registry.json")
--repository-cache string path to the file containing cached repository indexes (default "~/.cache/helm/repository")
--repository-config string path to the file containing repository names and URLs (default "~/.config/helm/repositories.yaml")
4 使用案例
4.1 helm repo add
4.1.1 功能
新增chart仓库
4.1.2 语法格式
helm repo add [NAME] [URL]
4.1.3 案例
# helm repo add test-repo http://mirror.kaiyuanshe.cn/kubernetes/charts/
"test-repo" has been added to your repositories
4.2 helm repo list
4.2.1 功能
列举chart仓库
4.2.2 语法格式
helm repo list [flags]
4.2.3 案例
# helm repo list
NAME URL
2 test-repo http://mirror.kaiyuanshe.cn/kubernetes/charts/
4.3 helm repo update
4.3.1 功能
从chart仓库中更新本地可用chart的信息,更新从各自chart仓库中获取的有关chart的最新信息。信息会缓存在本地,被诸如'helm search'等命令使用
4.3.2 语法格式
helm repo update [flags]
4.3.3 案例
# helm repo update test-repo
返回如下结果:
Hang tight while we grab the latest from your chart repositories...
...Successfully got an
update from the "test-repo" chart repository Update Complete. ⎈Happy Helming!⎈
4.4 helm repo remove
4.4.1 功能
删除chart仓库
4.4.2 语法格式
helm repo update [flags]
4.4.3 案例
使用 remove 命令可以删除一个或多个仓库:
helm repo remove test-tepo
返回如下结果:
"test-repo" has been removed from your repositories
4.5 helm repo index
4.5.1 功能
基于包含打包chart的目录,生成索引文件
4.5.2 语法格式
读取当前目录,并根据找到的 chart 生成索引文件。
这个工具用来为chart仓库创建一个'index.yaml'文件,使用'--url'参数创建一个chart的绝对URL。
要合并生成的索引和已经存在的索引文件时,使用'--merge'参数。在这个场景中,在当前目录中找到的chart会合并到已有索引中, 本地chart的优先级高于已有chart。
helm repo index [DIR] [flags]
4.5.3 案例
如果你想使用指定目录来做为 Helm Repository 的存储目录,可以加上 --repo-path 参数:
$ helm serve --address 192.168.100.211:8879 --repo-path /data/helm/repository/ --url http://192.168.100.211:8879/charts/
通过 helm repo index 命令将 Chart 的 Metadata 记录更新在 index.yaml 文件中:
# 更新 Helm Repository 的索引文件
$ cd /home/k8s/.helm/repository/local
$ helm repo index --url=http://192.168.100.211:8879 .
完成启动本地 Helm Repository Server 后,就可以将本地 Repository 加入 Helm 的 Repo 列表。
$ helm repo add local http://127.0.0.1:8879
"local" has been added to your repositories
现在再次查找 mychart 包,就可以搜索到了。
$ helm repo update
$ helm search mychart
NAME CHART VERSION APP VERSION DESCRIPTION
local/mychart 0.1.0 1.0 A Helm chart for Kubernetes