etcd、flannel的安装---单节点

  • etcd的安装和配置
[root@localhost zh]# yum install etcd

[root@localhost zh]# service etcd start

//因为我是单节点,所以没有修改我的配置文件,下面默认的配置文件内容
[root@localhost zh]# vim /etc/etcd/etcd.conf
#[Member]
#ETCD_CORS=""
ETCD_DATA_DIR="/var/lib/etcd/default.etcd"
#ETCD_WAL_DIR=""
#ETCD_LISTEN_PEER_URLS="http://localhost:2380"
ETCD_LISTEN_CLIENT_URLS="http://localhost:2379"
#ETCD_MAX_SNAPSHOTS="5"
#ETCD_MAX_WALS="5"
ETCD_NAME="default"
#ETCD_SNAPSHOT_COUNT="100000"
#ETCD_HEARTBEAT_INTERVAL="100"
#ETCD_ELECTION_TIMEOUT="1000"
#ETCD_QUOTA_BACKEND_BYTES="0"
#ETCD_MAX_REQUEST_BYTES="1572864"
#ETCD_GRPC_KEEPALIVE_MIN_TIME="5s"
#ETCD_GRPC_KEEPALIVE_INTERVAL="2h0m0s"
#ETCD_GRPC_KEEPALIVE_TIMEOUT="20s"
#
#[Clustering]
#ETCD_INITIAL_ADVERTISE_PEER_URLS="http://localhost:2380"
ETCD_ADVERTISE_CLIENT_URLS="http://localhost:2379"


//用etcdctl管理
[root@localhost zh]# etcdctl mkdir /test
[root@localhost zh]# etcdctl ls /
/test
[root@localhost zh]# etcdctl --endpoints  http://localhost:2379 ls /
/test
[root@localhost zh]# etcdctl --endpoints  http://localhost:2379 mkdir /web
[root@localhost zh]# etcdctl --endpoints  http://localhost:2379 set /web/web001 "test"
test
[root@localhost zh]# etcdctl --endpoints  http://localhost:2379 get /web/web001
test

//设置分配给docker的网段
[root@localhost zh]# etcdctl  mk /atomic.io/network/config '{"Network":"172.17.0.0/16", "SubnetMin": "172.17.1.0", "SubnetMax": "172.17.254.0"}'

  • flannel的下载和配置
[root@localhost zh]# yum install flannel

//这是默认的内容,我没有修改
[root@localhost zh]#  vim /etc/sysconfig/flanneld
# Flanneld configuration options  

# etcd url location.  Point this to the server where etcd runs
FLANNEL_ETCD_ENDPOINTS="http://127.0.0.1:2379"

# etcd config key.  This is the configuration key that flannel queries
# For address range assignment
FLANNEL_ETCD_PREFIX="/atomic.io/network"

# Any additional options that you want to pass
#FLANNEL_OPTIONS=""

[root@localhost zh]# systemctl daemon-reload

[root@localhost zh]# service flanneld start

[root@localhost zh]# service flanneld restart

//查看状态
[root@localhost log]# service flanneld status

//查看日志
[root@localhost log]# flanneld -alsologtostderr

//查看flannel0的ip
[root@localhost zh]# ifconfig flannel0
flannel0: flags=4305  mtu 1472
        inet 172.17.93.0  netmask 255.255.0.0  destination 172.17.93.0
        inet6 fe80::ec5:b110:cdc7:5a6a  prefixlen 64  scopeid 0x20
        unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  txqueuelen 500  (UNSPEC)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 3  bytes 144 (144.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

 

转载于:https://www.cnblogs.com/zhao1070285683/p/10380832.html

你可能感兴趣的:(etcd、flannel的安装---单节点)