Day 02 Overseas Mirror Construction
1. Find the network plug-in we need
1. Github search for plugins we need
Then we read the readme document, there are how to work, introduction and other information, we found the following content
Our version is 1.19, so we need to use this command
2. View the contents of the file
2.1 We can directly view the relevant information inside, enter the address in the browser
2.2 It can also be downloaded and viewed through the wget function of linux
wget https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
# 有用 默认保存为 kube-flannel.yml
View
vim kube-flannel.yml
2.3 Analysis
Because this is a deployment file, it depends on docker, so it should be deployed as a docker image, so let's check the image in it
cat kube-flannel.yml | grep image
--------------------------------------------------
image: quay.io/coreos/flannel:v0.13.1-rc1
image: quay.io/coreos/flannel:v0.13.1-rc1 # 这其实是一个镜像 用了两次
We can try to pull it down, but it defaults to a foreign source and may not be able to pull it down
docker pull quay.io/coreos/flannel:v0.13.1-rc1
Can't pull it down
We can use the cloud service platform to pull from their overseas sources to the domestic warehouse of our own project, and then pull from our own warehouse
Second, build a mirror image through the cloud service platform
1 Log in to the cloud service platform and enter the service list through the console to enter the code hosting service
1.1 find code hosting
1.2 Create a code project
If you need to buy for the first time, you don’t need to spend 0 yuan to buy, then we immediately use to create a project warehouse
The k8s project is created here, which will be used later
Note: You need to bind your 云code
account when creating the mirror for the first time (later) , but the new version cannot be bound, we need to use the old version, and then enter the mailbox token to create!
1.3 Jump to the created project-add file branch
1.4 Create a Dockfile file
The need here is to create a flannel folder and then create a Dockerfile file. If you only write one, the default is a file, not a folder
2. Create a mirror project warehouse
Then the warehouse is created, and then we enter a warehouse and build a mirror
3. Mirror construction
Click build------------>Add rule
[External link image transfer failed. The source site may have an anti-leech link mechanism. It is recommended to save the image and upload it directly (img-32eaLl4X-1607442152410)(C:\Users\S\AppData\Roaming\Typora\typora-user-images\ image-20201208210942726.png)]
After the rule is added, it can be built
So the mirror is built
4. Use
Back to the installation of the k8s network plug-in, because the kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml command needs to be executed on version 1.17, the main part of this command The content is to pull the mirror image from an overseas address . Due to various reasons, we cannot get the mirror image from overseas, but we can get this file, so we need to modify the mirror source in this file to achieve the purpose of pulling the mirror image.
Then we got the required mirror image through overseas mirror construction, so we can modify the overseas mirror source to our own.
Modify the kube-flannel.yml
mirror source configuration
vim kube-flannel.yml
a insert 模式进行编辑
/image 找到镜像位置
Replace with your own mirror source
The mirror version is the same as in step three
registry.cn-hangzhou.aliyuncs.com/k8s2me/flannel99:v0.13.1-crl
Note image:
followed by a space!
kubectl apply -f kube-flannel.yml
Finally wait for him to initialize