From 1cc0f3c8c9e43a2e40d668516816b51d473c11ac Mon Sep 17 00:00:00 2001 From: Kay Yan Date: Mon, 17 Oct 2022 06:11:23 +0000 Subject: [PATCH] mirror-for-china --- README.md | 1 + docs/mirror.md | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 docs/mirror.md diff --git a/README.md b/README.md index dcc20c2ab..9fef8c887 100644 --- a/README.md +++ b/README.md @@ -113,6 +113,7 @@ vagrant up - [Air-Gap installation](docs/offline-environment.md) - [NTP](docs/ntp.md) - [Hardening](docs/hardening.md) +- [Mirror](docs/mirror.md) - [Roadmap](docs/roadmap.md) ## Supported Linux Distributions diff --git a/docs/mirror.md b/docs/mirror.md new file mode 100644 index 000000000..3138d2034 --- /dev/null +++ b/docs/mirror.md @@ -0,0 +1,66 @@ +# Public Download Mirror + +The public mirror is useful to make the public resources download quickly in some areas of the world. (such as China). + +## Configuring Kubespray to use a mirror site + +You can follow the [offline](offline-environment.md) to config the image/file download configuration to the public mirror site. If you want to download quickly in China, the configuration can be like: + +```shell +gcr_image_repo: "gcr.m.daocloud.io" +kube_image_repo: "k8s.m.daocloud.io" +docker_image_repo: "docker.m.daocloud.io" +quay_image_repo: "quay.m.daocloud.io" +github_image_repo: "ghcr.m.daocloud.io" + +files_repo: "https://files.m.daocloud.io" +``` + +Use mirror sites only if you trust the provider. The Kubespray team cannot verify their reliability or security. +You can replace the `m.daocloud.io` with any site you want. + +## Example Usage Full Steps + +You can follow the full steps to use the kubesray with mirror. for example: + +Install Ansible according to Ansible installation guide then run the following steps: + +```shell +# Copy ``inventory/sample`` as ``inventory/mycluster`` +cp -rfp inventory/sample inventory/mycluster + +# Update Ansible inventory file with inventory builder +declare -a IPS=(10.10.1.3 10.10.1.4 10.10.1.5) +CONFIG_FILE=inventory/mycluster/hosts.yaml python3 contrib/inventory_builder/inventory.py ${IPS[@]} + +# Use the download mirror +cp inventory/mycluster/group_vars/all/offline.yml inventory/mycluster/group_vars/all/mirror.yml +sed -i -E '/# .*\{\{ files_repo/s/^# //g' inventory/mycluster/group_vars/all/mirror.yml +tee -a inventory/mycluster/group_vars/all/mirror.yml <