Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Docker combined with flannel network

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Etcd installation

Cluster mode is recommended in production environment.

Wget https://github.com/etcd-io/etcd/releases/download/v3.3.15/etcd-v3.3.15-linux-amd64.tar.gztar-zxvf etcd-v3.3.15-linux-amd64.tar.gz & & cd etcd-v3.3.15-linux-amd64mv etcd* / usr/local/bin/mkdir / var/lib/etcd/

Cat / usr/lib/systemd/system/etcd.service [Unit] Description=Etcd ServerAfter=netNork.targetAfter=network-online.targetWants=network- online.target [service] Type=notifyExecStart=/usr/local/bin/etcd\-name=etcd\-- data-dir=/var/lib/etcd/default.etcd\-- listen-peer-urls= http://192.168.3.155:2380\-- listen-client-urls= http://192.168.3.155:2379, Http://127.0.0.1:2379\-- advertise-client-urls= http://192.168.3.155:2379\-- initial-advertise-peer-urls= http://192.168.3.155:2380\-- initial-cluster=etcd= http://192.168.3.155:2380\-- initial-cluster-token=etcd-cluster\-- initial-cluster-state=newRestart=on-failureLimitNOFILE=65536 [Install] WantedBy=multi-user.target

Systemctl start etcd

Install flannel

Yum-y install flannel

Cat / etc/sysconfig/flanneld

FLANNEL_ETCD_ENDPOINTS= "http://192.168.3.155:2379"

FLANNEL_ETCD_PREFIX= "/ atomic.io/network"

Register the network configuration of flannel to etcd

The default api for version 3.3.15 is V3 flags. Support for V2 version.

ETCDCTL_API=2 etcdctl-- endpoint= http://192.168.3.155:2379 set / atomic.io/network/config'{"Network": "172.17.0.0 Network", "SubnetMin": "172.17.1.0", "SubnetMax": "172.17.254.0", "Backend": {"Type": "vxlan"}'

Systemctl start flannel

After Flannel starts, the network configuration information will be obtained from etcd

Subnetting and registering in etcd

Write the network configuration to / run/flannel/subnet.env and generate the / run/flannel/docker file through script

View etcd registration information

Modify docker startup parameters

Cat / usr/lib/systemd/system/docker.service

EnvironmentFile=/var/run/flannel/docker

ExecStart=/usr/bin/dockerd $DOCKER_NETWORK_OPTIONS

Systemctl daemon-reload & & systemctl restart docker

View IP

Reference:

Https://coreos.com/flannel/docs/latest/running.html#docker-integration

Https://coreos.com/flannel/docs/latest/flannel-config.html

Https://github.com/etcd-io/etcd

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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report