Best practices for deploying Rancher v2.x and Rancher provisioned Kubernetes clusters in China

Follow
Table of Contents

Task

Users might experience a slow or unstable connection to GitHub and Docker Hub from China. As a result, Rancher Docker images and catalogs should be configured to use the Alibaba Cloud Docker image registry and Gitee git repositories, when deploying Rancher and downstream clusters within China. This article details how to configure these in Rancher Kubernetes Engine (RKE) CLI or Rancher v2.x provisioned clusters.

Pre-requisites

Configure the Alibaba Cloud Docker image repository for installation of Rancher v2.x

A single Docker container installation of Rancher

Specify the repository URL in the docker run command, e.g.:

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

A Highly Available (HA) installation of Rancher in a Kubernetes cluster

Specify private_registries in the RKE configuration file (cluster.yaml), e.g.:

nodes:
  - address: x.x.x.x
    internal_address: y.y.y.y
    user: ubuntu
    role: [controlplane,worker,etcd]
private_registries:
     - url: registry.cn-hangzhou.aliyuncs.com
       is_default: true

Helm v2 installation only

Specify the tiller-image for tiller initialisation. e.g.:

helm init --service-account tiller --tiller-image registry.cn-hangzhou.aliyuncs.com/google_containers/tiller:<tag>

The list of tiller image tags are available here.

Downstream clusters

Configure the system-default-registry for Rancher, setting the value to registry.cn-hangzhou.aliyuncs.com, per the following example:

system-default-registry.png

Configure the Gitte git repository for Rancher App catalogs

Having installed Rancher, replace the default catalog URLs with the equivalent Gitee URLs, per the following table:

Rancher Catalog URL Rancher GitHub URL Rancher Gitee URL
https://git.rancher.io/helm3-charts https://github.com/rancher/helm3-charts https://gitee.com/rancher/helm3-charts
https://git.rancher.io/charts https://github.com/rancher/charts https://gitee.com/rancher/charts
https://git.rancher.io/system-charts https://github.com/rancher/system-charts https://gitee.com/rancher/system-charts
Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.