背景说明
国内使用 Helm Hub,对于绝大多数开发者来说都是很痛苦的一件事情。原因很简单,随便打开一个 Charts 文件,你就会看到这个文件里充斥着大量的不可访问的镜像 URL。
官方仓库:https://artifacthub.io/
解决方案
AppHub
官网地址:https://developer.aliyun.com/hub
开源地址:https://github.com/cloudnativeapp/charts
AppHub 是一个托管在国内公有云上、全公益性的 Helm Hub “中国站”,它的后端由阿里云容器平台团队的三位工程师利用 20% 时间开发完成。而这个站点的一个重要职责,就是把所有 Helm 官方 Hub 托管的应用自动同步到国内;同时自动将 Charts 文件中的 gcr.io 等所有有网络访问问题的 URL 替换成为稳定的国内镜像 URL 。这样,国内的开发者也可以自由的使用 helm install 来安装应用了。
[root@cka-master helm] helm repo add apphub https://apphub.aliyuncs.com
https://kubernetes.oss-cn-hangzhou.aliyuncs.com/charts阿里云2018年11月后不再更新
Elastic
[root@cka-master helm] helm repo add elastic https://helm.elastic.co
Azure
[root@cka-master helm] helm repo add azure http://mirror.azure.cn/kubernetes/charts
GitHub
[root@cka-master helm] helm repo add github https://burdenbear.github.io/kube-charts-mirror
补充说明
如果helm源存在密码则使用如下格式
[root@cka-master helm]# helm repo add -h
add a chart repository
Usage:
helm repo add [NAME] [URL] [flags]
Flags:
--allow-deprecated-repos by default, this command will not allow adding official repos that have been permanently deleted. This disables that behavior
--ca-file string verify certificates of HTTPS-enabled servers using this CA bundle
--cert-file string identify HTTPS client using this SSL certificate file
--force-update replace (overwrite) the repo if it already exists
-h, --help help for add
--insecure-skip-tls-verify skip tls certificate checks for the repository
--key-file string identify HTTPS client using this SSL key file
--no-update Ignored. Formerly, it would disabled forced updates. It is deprecated by force-update.
--pass-credentials pass credentials to all domains
--password string chart repository password
--password-stdin read chart repository password from stdin
--username string chart repository username
Global Flags:
--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 "/root/.config/helm/registry/config.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")
[root@cka-master helm]#
[root@cka-master helm] helm repo add --username=pf --password=password myrepo https://demo.goharbor.io/chartrepo/helmcharts