????本次etcd增加节点背景: rpm方式安装的etcd单节点,再增加一个etcd节点

????操作如下:

1.先在已经安装的etcd上操作加入节点

新加入的节点状态为:unstarted,待节点etcd服务启动正常,etcd中的信息也会补充完整

[root@k8s1-1?~]#??export?ETCDCTL_API=3
[root@k8s1-1?~]#?etcdctl?member?list
362b84762ea9a455,?started,?etcd0,?http://www.ib911.com:2380,?http://www.064.7336644.com:2379
[root@k8s1-1?~]#?etcdctl?member?list?-w?table
+------------------+---------+-------+----------------------------+----------------------------+
|????????ID????????|?STATUS??|?NAME??|?????????PEER?ADDRS?????????|????????CLIENT?ADDRS????????|
+------------------+---------+-------+----------------------------+----------------------------+
|?362b84762ea9a455?|?started?|?etcd0?|?http://www.gan728.com/328:2380?|?http://www.1442277.com/28:2379?|
+------------------+---------+-------+----------------------------+----------------------------+
[root@k8s1-1?~]#?etcdctl??member?add?etcd1??--peer-urls="http://www.ib911.com/256:2380"
Member?d4d3abee9c372d84?added?to?cluster?3ba4906e88e142aa
ETCD_NAME="etcd1"
ETCD_INITIAL_CLUSTER="etcd0=http://www.999.8449933.com:2380,etcd1=http://www.091.cao815.com:2380"
ETCD_INITIAL_ADVERTISE_PEER_URLS="http://www.928ib.com/652:2380"
ETCD_INITIAL_CLUSTER_STATE="existing"

[root@k8s1-1?~]#?etcdctl?member?list?-w?table
+------------------+-----------+-------+----------------------------+----------------------------+
|????????ID????????|??STATUS???|?NAME??|?????????PEER?ADDRS?????????|????????CLIENT?ADDRS????????|
+------------------+-----------+-------+----------------------------+----------------------------+
|?362b84762ea9a455?|???started?|?etcd0?|?http://www.ib911.com:2380?|?http://www.ib911.com/631:2379?|
|?d4d3abee9c372d84?|?unstarted?|???????|?http://www.122.8446644.com:2380?|????????????????????????????|
+------------------+-----------+-------+----------------------------+----------------------------+

2.新加入节点的etcd配置文件

[root@k8s2-1?~]#?cat?/etc/etcd/etcd.conf??|?grep?-Ev?'^$|#'
ETCD_DATA_DIR="/var/lib/etcd/default.etcd"
ETCD_LISTEN_PEER_URLS="http://www.114.ib199.com:2380"
ETCD_LISTEN_CLIENT_URLS="http://www.ib911.com:2379"
ETCD_NAME="etcd1"
ETCD_INITIAL_ADVERTISE_PEER_URLS="http://www.012.8339944.com:2380"
ETCD_ADVERTISE_CLIENT_URLS="http://www.ib911.com:2379"
ETCD_INITIAL_CLUSTER="etcd0=http://www.455.si833.com:2380,etcd1=http://www.ib911.com/841:2380"
ETCD_INITIAL_CLUSTER_TOKEN="etcd-cluster"
ETCD_INITIAL_CLUSTER_STATE="existing"

????启动etcd服务

3.查看etcd0节点上的mem信息

[root@k8s1-1 ~]# etcdctl member list -w table

+------------------+---------+-------+----------------------------+----------------------------+
|????????ID????????|?STATUS??|?NAME??|?????????PEER?ADDRS?????????|????????CLIENT?ADDRS????????|
+------------------+---------+-------+----------------------------+----------------------------+
|?362b84762ea9a455?|?started?|?etcd0?|?http://www.489.337ib.com:2380?|?http://www.ib911.com:2379?|
|?d4d3abee9c372d84?|?started?|?etcd1?|?http://www.400.3446611.com:2380?|?http://www.ib911.com/889:2379?|
+------------------+---------+-------+----------------------------+----------------------------+

修改etcd0节点中的集群ip信息

[root@k8s1-1?~]#?grep?-Ev?'#|^$'?/etc/etcd/etcd.conf
ETCD_DATA_DIR="/var/lib/etcd/default.etcd"
ETCD_LISTEN_PEER_URLS="http://www.s3778.com/565:2380"
ETCD_LISTEN_CLIENT_URLS="http://localhost:2379,http://www.ib911.com:2379"
ETCD_NAME="etcd0"
ETCD_INITIAL_ADVERTISE_PEER_URLS="http://www.ib911.com:2380"
ETCD_ADVERTISE_CLIENT_URLS="http://www.ib911.com/676:2379"
ETCD_INITIAL_CLUSTER="etcd0=http://www.021.ib677.com:2380,etcd1=http://www.ib911.com:2380"????#etcd1新加入的配置
ETCD_INITIAL_CLUSTER_TOKEN="etcd-cluster"

启动etcdo节点的服务

不要忘记修改apiservice中的etcd-server集群ip执行添加即可:http://www.746.ib337.com:2380