Day 02 Overseas Mirror Construction

Day 02 Overseas Mirror Construction

1. Find the network plug-in we need

1. Github search for plugins we need

image-20201208170241204

Then we read the readme document, there are how to work, introduction and other information, we found the following content

image-20201208171047234

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

image-20201208171321580

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

image-20201208171603964

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

image-20201208191149299

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 云codeaccount 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!

image-20201208204719866

1.3 Jump to the created project-add file branch

image-20201208204852206

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

image-20201208205107153

image-20201208193254972

2. Create a mirror project warehouse

image-20201208201020635

image-20201208204446879

Then the warehouse is created, and then we enter a warehouse and build a mirror

3. Mirror construction

image-20201208210647519

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

image-20201208211059052

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.ymlmirror source configuration

vim kube-flannel.yml

a insert 模式进行编辑 
/image 找到镜像位置

image-20201208214824996

Replace with your own mirror source

image-20201208215050902

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!

image-20201208220257102

kubectl apply -f kube-flannel.yml

Finally wait for him to initialize

Guess you like

Origin blog.csdn.net/A1L__/article/details/110900511