Requirements
This paper takes kubespray as an example, other approaches are similar.
- A cloud host in Hong Kong or other non-mainland China
- Cloud hosts need to install docker
Install kubespray and generate inventory
1 | git clone https://github.com/kubernetes-sigs/kubespray |
Modify the inventory/drycc/group_vars/all/docker.yml
file
1 | docker_insecure_registries: |
Start proxy and docker mirrors
This step needs to be performed on cloud hosts in non-mainland China. Let’s assume that his IP is 47.15.11.11
.
1 | git clone https://github.com/duanhongyi/docker-mirrors |
DNS hijacking
Let’s take modifying /etc/hosts
as an example and hijack DNS to this cloud host.
1 | 47.52.172.207 gcr.io quay.io |
That’s good. You can install kubernetes happily.
1 | ansible-playbook -i inventory/drycc/hosts.ini --become --become-user=root cluster.yml |
Other options
After installation, you can also hijack the DNS of kubernetes to the cloud host.
Take coredns as an example:
1 | kubectl edit ConfigMap/coredns -n kube-system |
Modify the data item:
1 | apiVersion: v1 |