千家信息网

如何在国内优雅地使用Rancher

发表于:2026-11-01 作者:千家信息网编辑
千家信息网最后更新 2026年11月01日,这篇文章将为大家详细讲解有关如何在国内优雅地使用Rancher,文章内容质量较高,因此小编分享给大家做个参考,希望大家阅读完这篇文章后对相关知识有一定的了解。Rancher进入中国已经4年,并在今年2
千家信息网最后更新 2026年11月01日如何在国内优雅地使用Rancher

这篇文章将为大家详细讲解有关如何在国内优雅地使用Rancher,文章内容质量较高,因此小编分享给大家做个参考,希望大家阅读完这篇文章后对相关知识有一定的了解。


Rancher进入中国已经4年,并在今年2月份完成了中国本土化和国产化。作为一款开源的企业级Kubernetes管理平台,我们一直十分关注Rancher社区用户的各种诉求。在我们的技术社区中,我们常常收到这样的抱怨:从Github上下载资源慢、拉镜像十分耗时、无法使用library和system-library等。这些大大降低了国内用户的Rancher使用体验。

ksd@Hailong-MacBook-Pro  /tmp  wget https://github.com/rancher/rke/releases/download/v1.0.8/rke_linux-amd64--2020-05-07 10:20:30--  https://github.com/rancher/rke/releases/download/v1.0.8/rke_linux-amd64Resolving github.com... 13.250.177.223Connecting to github.com|13.250.177.223|:443... connected.HTTP request sent, awaiting response... 302 FoundLocation: https://github-production-release-asset-2e65be.s3.amazonaws.com/108337180/26415380-8ebd-11ea-834a-af693358e976?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20200507%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20200507T022031Z&X-Amz-Expires=300&X-Amz-Signature=f4659696f17f619d1d42bfc0a78d998c12c34506475983eb523f150a22a4ce51&X-Amz-SignedHeaders=host&actor_id=0&repo_id=108337180&response-content-disposition=attachment%3B%20filename%3Drke_linux-amd64&response-content-type=application%2Foctet-stream [following]--2020-05-07 10:20:31--  https://github-production-release-asset-2e65be.s3.amazonaws.com/108337180/26415380-8ebd-11ea-834a-af693358e976?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20200507%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20200507T022031Z&X-Amz-Expires=300&X-Amz-Signature=f4659696f17f619d1d42bfc0a78d998c12c34506475983eb523f150a22a4ce51&X-Amz-SignedHeaders=host&actor_id=0&repo_id=108337180&response-content-disposition=attachment%3B%20filename%3Drke_linux-amd64&response-content-type=application%2Foctet-streamResolving github-production-release-asset-2e65be.s3.amazonaws.com... 52.216.65.240Connecting to github-production-release-asset-2e65be.s3.amazonaws.com|52.216.65.240|:443... failed: Operation timed out.Retrying.

无法从Github上下载Rancher资源

拉取镜像慢,等待集群启动时间长

2020/05/07 03:06:27 [INFO] Pulling image [rancher/rke-tools:v0.1.56] on host [172.17.206.119], try #12020/05/07 03:09:16 [INFO] Pulling image [rancher/hyperkube:v1.17.5-rancher1] on host [172.17.206.119], try #12020/05/07 03:09:16 [INFO] cluster [c-zfz4g] provisioning: Pre-pulling kubernetes images

拉取rancher镜像常常出现timeout情况

无法使用library和system-library,导致无法使用应用商店

2020/05/07 03:31:31 [ERROR] CatalogController helm3-library [catalog] failed with : Remote commit check failed: Repo [https://git.rancher.io/helm3-charts] is not accessible: Get https://git.rancher.io/repos/helm3-charts/commits/master: net/http: request canceled (Client.Timeout exceeded while awaiting headers)2020/05/07 03:31:33 [ERROR] CatalogController library [catalog] failed with : Remote commit check failed: Repo [https://git.rancher.io/charts] is not accessible: Get https://git.rancher.io/repos/charts/commits/master: net/http: request canceled (Client.Timeout exceeded while awaiting headers)2020/05/07 03:31:34 [ERROR] CatalogController system-library [catalog] failed with : Remote commit check failed: Repo [https://git.rancher.io/system-charts] is not accessible: Get https://git.rancher.io/repos/system-charts/commits/release-v2.4: net/http: request canceled (Client.Timeout exceeded while awaiting headers)

rancher/rancher日志,显示一些关于git.rancher.io timeout的错误日志

为了改善大家的使用体验,我们针对以上问题分别提出了解决方法。

优雅地使用Rancher

为了让大家更流畅地使用Rancher,我们将一些资源mirror到了国内,提供给国内用户使用。接下来,我们将详细介绍如何使用这些资源。

使用国内资源下载Rancher组件

我们已经将Rancher的常用组件放在国内服务器上,访问此链接 ,即可下载所需的组件,从此告别failed: Operation timed out

使用阿里云镜像仓库搭建Rancher

我们已经在阿里云镜像仓库中同步了一份原版的镜像,仓库地址: registry.cn-hangzhou.aliyuncs.com

注意:阿里云镜像仓库中的rancher镜像不支持使用 latest、stable等tags,必须指定版本号,例如v2.4.2

接下来,我们来demo如何操作:

1、 使用阿里云镜像仓库的Rancher镜像启动Rancher

docker run -itd -p 80:80 -p 443:443 \    --restart=unless-stopped \    -e CATTLE_AGENT_IMAGE="registry.cn-hangzhou.aliyuncs.com/rancher/rancher-agent:v2.4.2" \    registry.cn-hangzhou.aliyuncs.com/rancher/rancher:v2.4.2

CATTLE_AGENT_IMAGE: 指定rancher-agent的镜像名称

2、 设置默认镜像仓库

从UI导航到Settings,然后编辑system-default-registry,Value设置为registry.cn-hangzhou.aliyuncs.com

system-default-registry的参数设置请参考官方文档。

接下来,我们按照官方文档添加自定义集群,只需要等待集群启动成功即可。下图中列出了system-project中所有的workload,这些workload均使用了阿里云的镜像仓库registry.cn-hangzhou.aliyuncs.com内的镜像:

仅需3-5分钟就能完成整个集群的搭建,将大幅节省时间,提高工作效率。

使用码云代替Github

Rancher默认使用Github上的repo作为应用商店的URL,如果出现timeout情况,可以将Catalog URL替换成码云的地址。

每个repo的对应关系如下:

(点击文章开头链接可获取可复制版本)

那么如何修改Catalog URL呢?

  1. 导航到全局或项目级别的Apps -> Manage Catalogs

  2. 点击列表右侧的省略号 -> Edit

  3. 将Catalog URL替换成码云中的地址即可,点击Save

  4. 此时,对应的Catalog的状态变为Refreshed,等待其变为Active之后即可正常使用

关于如何在国内优雅地使用Rancher就分享到这里了,希望以上内容可以对大家有一定的帮助,可以学到更多知识。如果觉得文章不错,可以把它分享出去让更多的人看到。

镜像 仓库 资源 阿里 集群 优雅 接下来 地址 文章 用户 组件 上下 内容 商店 官方 情况 文档 日志 时间 更多 数据库的安全要保护哪些东西 数据库安全各自的含义是什么 生产安全数据库录入 数据库的安全性及管理 数据库安全策略包含哪些 海淀数据库安全审计系统 建立农村房屋安全信息数据库 易用的数据库客户端支持安全管理 连接数据库失败ssl安全错误 数据库的锁怎样保障安全 华服互联网科技靠谱吗 互联网科技工作委员会主任 金融科技创新监管互联网金融 互联网科技公司电话 嘟嘟瓜互联网科技 互联网科技论文 睿民互联网科技 互联网科技logo 丰台科技园 互联网公司 中盈科技互联网信息有限公司 互联网之后的科技是什么 银川新华互联网科技职业技术培训学校图片 宁夏科技产业互联网案例 互联网和黑科技的看法 移动互联网科技公司 银行科技岗属于互联网吗 银川新华互联网科技学校原画 河南商务圈互联网科技有限公司 山东亿川互联网科技有限责任公司 小牛互联网科技有限公司地址 科技和互联网公司 西安互联网科技 世界互联网领先科技成果 友谊互联网络科技 互联网科技创新服务 互联网科技扶贫时间 2021世界互联网领先科技成果发布 山东大美朱楼互联网科技有限公司 北京军民互联网科技公司 广西泛欧互联网科技有限公司
0