背景说明

国内使用 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 来安装应用了。

  1. [root@cka-master helm] helm repo add apphub https://apphub.aliyuncs.com

https://kubernetes.oss-cn-hangzhou.aliyuncs.com/charts阿里云2018年11月后不再更新

Elastic

  1. [root@cka-master helm] helm repo add elastic https://helm.elastic.co

Azure

  1. [root@cka-master helm] helm repo add azure http://mirror.azure.cn/kubernetes/charts

GitHub

  1. [root@cka-master helm] helm repo add github https://burdenbear.github.io/kube-charts-mirror

补充说明

如果helm源存在密码则使用如下格式

  1. [root@cka-master helm]# helm repo add -h
  2. add a chart repository
  3. Usage:
  4. helm repo add [NAME] [URL] [flags]
  5. Flags:
  6. --allow-deprecated-repos by default, this command will not allow adding official repos that have been permanently deleted. This disables that behavior
  7. --ca-file string verify certificates of HTTPS-enabled servers using this CA bundle
  8. --cert-file string identify HTTPS client using this SSL certificate file
  9. --force-update replace (overwrite) the repo if it already exists
  10. -h, --help help for add
  11. --insecure-skip-tls-verify skip tls certificate checks for the repository
  12. --key-file string identify HTTPS client using this SSL key file
  13. --no-update Ignored. Formerly, it would disabled forced updates. It is deprecated by force-update.
  14. --pass-credentials pass credentials to all domains
  15. --password string chart repository password
  16. --password-stdin read chart repository password from stdin
  17. --username string chart repository username
  18. Global Flags:
  19. --debug enable verbose output
  20. --kube-apiserver string the address and the port for the Kubernetes API server
  21. --kube-as-group stringArray group to impersonate for the operation, this flag can be repeated to specify multiple groups.
  22. --kube-as-user string username to impersonate for the operation
  23. --kube-ca-file string the certificate authority file for the Kubernetes API server connection
  24. --kube-context string name of the kubeconfig context to use
  25. --kube-token string bearer token used for authentication
  26. --kubeconfig string path to the kubeconfig file
  27. -n, --namespace string namespace scope for this request
  28. --registry-config string path to the registry config file (default "/root/.config/helm/registry/config.json")
  29. --repository-cache string path to the file containing cached repository indexes (default "/root/.cache/helm/repository")
  30. --repository-config string path to the file containing repository names and URLs (default "/root/.config/helm/repositories.yaml")
  31. [root@cka-master helm]#
  32. [root@cka-master helm] helm repo add --username=pf --password=password myrepo https://demo.goharbor.io/chartrepo/helmcharts