You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

66 lines
2.6 KiB

  1. # Public Download Mirror
  2. The public mirror is useful to make the public resources download quickly in some areas of the world. (such as China).
  3. ## Configuring Kubespray to use a mirror site
  4. 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:
  5. ```shell
  6. gcr_image_repo: "gcr.m.daocloud.io"
  7. kube_image_repo: "k8s.m.daocloud.io"
  8. docker_image_repo: "docker.m.daocloud.io"
  9. quay_image_repo: "quay.m.daocloud.io"
  10. github_image_repo: "ghcr.m.daocloud.io"
  11. files_repo: "https://files.m.daocloud.io"
  12. ```
  13. Use mirror sites only if you trust the provider. The Kubespray team cannot verify their reliability or security.
  14. You can replace the `m.daocloud.io` with any site you want.
  15. ## Example Usage Full Steps
  16. You can follow the full steps to use the kubesray with mirror. for example:
  17. Install Ansible according to Ansible installation guide then run the following steps:
  18. ```shell
  19. # Copy ``inventory/sample`` as ``inventory/mycluster``
  20. cp -rfp inventory/sample inventory/mycluster
  21. # Update Ansible inventory file with inventory builder
  22. declare -a IPS=(10.10.1.3 10.10.1.4 10.10.1.5)
  23. CONFIG_FILE=inventory/mycluster/hosts.yaml python3 contrib/inventory_builder/inventory.py ${IPS[@]}
  24. # Use the download mirror
  25. cp inventory/mycluster/group_vars/all/offline.yml inventory/mycluster/group_vars/all/mirror.yml
  26. sed -i -E '/# .*\{\{ files_repo/s/^# //g' inventory/mycluster/group_vars/all/mirror.yml
  27. tee -a inventory/mycluster/group_vars/all/mirror.yml <<EOF
  28. gcr_image_repo: "gcr.m.daocloud.io"
  29. kube_image_repo: "k8s.m.daocloud.io"
  30. docker_image_repo: "docker.m.daocloud.io"
  31. quay_image_repo: "quay.m.daocloud.io"
  32. github_image_repo: "ghcr.m.daocloud.io"
  33. files_repo: "https://files.m.daocloud.io"
  34. EOF
  35. # Review and change parameters under ``inventory/mycluster/group_vars``
  36. cat inventory/mycluster/group_vars/all/all.yml
  37. cat inventory/mycluster/group_vars/k8s_cluster/k8s-cluster.yml
  38. # Deploy Kubespray with Ansible Playbook - run the playbook as root
  39. # The option `--become` is required, as for example writing SSL keys in /etc/,
  40. # installing packages and interacting with various systemd daemons.
  41. # Without --become the playbook will fail to run!
  42. ansible-playbook -i inventory/mycluster/hosts.yaml --become --become-user=root cluster.yml
  43. ```
  44. The above steps are by adding the "Use the download mirror" step to the [README.md](../README.md) steps.
  45. ## Community-run mirror sites
  46. DaoCloud(China)
  47. * [image-mirror](https://github.com/DaoCloud/public-image-mirror)
  48. * [files-mirror](https://github.com/DaoCloud/public-binary-files-mirror)