In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
Today, I will talk to you about how to install and configure flannel. Many people may not know much about it. In order to make you understand better, the editor has summarized the following for you. I hope you can get something according to this article.
Install and configure flannel
Build flannel
Flannel has no readily available execution files and must build itself. The most reliable way is to build in the Docker container. However, the docker image used for build is hosted in gcr.io, which may not be directly accessible in China. For your convenience, I mirror it to docker hub. The construction steps are as follows:
Download and rename image.
Docker pull cloudman6/kube-cross:v1.6.2-2
Docker tag cloudman6/kube-cross:v1.6.2-2 gcr.io/google_containers/kube-cross:v1.6.2-2
Download flannel source code.
Git clone https://github.com/coreos/flannel.git
Start building.
Cd flannel
Make dist/flanneld-amd64
Copy the flanneld execution file to host1 and host2.
Scp dist/flanneld-amd64 192.168.56.104:/usr/local/bin/flanneld
Scp dist/flanneld-amd64 192.168.56.105:/usr/local/bin/flanneld
Save the configuration information of the flannel network to etcd
First, write the configuration information to the file flannel-config.json, which is as follows:
{
"Network": "10.2.0.0 Universe 16"
"SubnetLen": 24
"Backend": {
"Type": "vxlan"
}
}
Network defines the IP pool for this network as 10.2.0.0 Universe 16.
SubnetLen specifies that the subnet size assigned to each host is 24 bits, or 10.2.X.0/24.
Backend is vxlan, that is, hosts communicate through vxlan, and we will discuss host-gw later.
Save the configuration to etcd:
Etcdctl-endpoints=192.168.56.101:2379 set / docker-test/network/config
< flannel-config.json /docker-test/network/config 是此 etcd 数据项的 key,其 value 为 flannel-config.json 的内容。key 可以任意指定,这个 key 后面会作为 flanneld 的一个启动参数。执行 etcdctl get 确保设置成功。Start flannel
Execute the following command on host1 and host2:
Flanneld-etcd-endpoints= http://192.168.56.101:2379-iface=enp0s8-etcd-prefix=/docker-test/network
-etcd-endpoints specifies etcd url.
-iface specifies the interface used for data transfer between hosts.
-etcd-prefix specifies the key where the etcd stores flannel network configuration information.
The output on host1 is as follows:
① enp0s8 is selected as the interface for communicating with external hosts.
② recognizes the flannel network pool 10.2.0.0 Universe 16.
The subnet assigned by ③ is 10.2.40.0swap 24.
After flanneld starts, some changes take place in the host1 internal network:
Host1 adds a route: packets with the destination address of flannel network 10.2.0.0lap16 are forwarded by flannel.1.
The output of host2 is similar, the main difference is that the subnet of host2 is 10.2.17.0
After reading the above, do you have any further understanding of how to install and configure flannel? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.