现象:
Kubernetes中etcd节点挂了,修复后重启失败

[root@node2 ~]# systemctl start etcd
Job for etcd.service failed because the control process exited with error code. See "systemctl status etcd.service" and "journalctl -xe" for details.

[root@node2 ~]#systemctl status etcd
● etcd.service - Etcd Server
   Loaded: loaded (/usr/lib/systemd/system/etcd.service; disabled; vendor preset: disabled)
   Active: failed (Result: start-limit) since 四 2021-04-15 11:09:53 CST; 8s ago
  Process: 74317 ExecStart=/opt/etcd/bin/etcd --name=${ETCD_NAME} --data-dir=${ETCD_DATA_DIR} --listen-peer-urls=${ETCD_LISTEN_PEER_URLS} --listen-client-urls=${ETCD_LISTEN_CLIENT_URLS},http://127.0.0.1:2379 --advertise-client-urls=${ETCD_ADVERTISE_CLIENT_URLS} --initial-advertise-peer-urls=${ETCD_INITIAL_ADVERTISE_PEER_URLS} --initial-cluster=${ETCD_INITIAL_CLUSTER} --initial-cluster-token=${ETCD_INITIAL_CLUSTER_TOKEN} --initial-cluster-state=new --cert-file=/opt/etcd/ssl/server.pem --key-file=/opt/etcd/ssl/server-key.pem --peer-cert-file=/opt/etcd/ssl/server.pem --peer-key-file=/opt/etcd/ssl/server-key.pem --trusted-ca-file=/opt/etcd/ssl/ca.pem --peer-trusted-ca-file=/opt/etcd/ssl/ca.pem (code=exited, status=1/FAILURE)
 Main PID: 74317 (code=exited, status=1/FAILURE)

4月 15 11:09:53 node2 systemd[1]: Failed to start Etcd Server.
4月 15 11:09:53 node2 systemd[1]: Unit etcd.service entered failed state.
4月 15 11:09:53 node2 systemd[1]: etcd.service failed.
4月 15 11:09:53 node2 systemd[1]: etcd.service holdoff time over, scheduling restart.
4月 15 11:09:53 node2 systemd[1]: Stopped Etcd Server.
4月 15 11:09:53 node2 systemd[1]: start request repeated too quickly for etcd.service
4月 15 11:09:53 node2 systemd[1]: Failed to start Etcd Server.
4月 15 11:09:53 node2 systemd[1]: Unit etcd.service entered failed state.
4月 15 11:09:53 node2 systemd[1]: etcd.service failed.

报错提示是请求过快
在这里插入图片描述
思路:
1、防火墙问题
2、检查/usr/lib/systemd/system/etcd.service服务启动
3、/opt/etcd/cfg/etcd配置文件
解决:
etcd节点挂了,但是之前是可以用的,所以直接排除防火墙问题和/opt/etcd/cfg/etcd配置文件里的问题。但是还是顺带检查一下。
1、防火墙
在这里插入图片描述
2、检查/usr/lib/systemd/system/etcd.service服务启动
我想会不会是启动脚本有问题

vim /usr/lib/systemd/system/etcd.service

[Unit]
Description=Etcd Server
After=network.target
After=network-online.target
Wants=network-online.target

[Service]
Type=notify
EnvironmentFile=/opt/etcd/cfg/etcd
ExecStart=/opt/etcd/bin/etcd --name=${ETCD_NAME} \
--data-dir=${ETCD_DATA_DIR} \
--listen-peer-urls=${ETCD_LISTEN_PEER_URLS} \
--listen-client-urls=${ETCD_LISTEN_CLIENT_URLS},http://127.0.0.1:2379 \
--advertise-client-urls=${ETCD_ADVERTISE_CLIENT_URLS} \
--initial-advertise-peer-urls=${ETCD_INITIAL_ADVERTISE_PEER_URLS} \
--initial-cluster=${ETCD_INITIAL_CLUSTER} \
--initial-cluster-token=${ETCD_INITIAL_CLUSTER_TOKEN} \
--initial-cluster-state=existing \
--cert-file=/opt/etcd/ssl/server.pem \
--key-file=/opt/etcd/ssl/server-key.pem \
--peer-cert-file=/opt/etcd/ssl/server.pem \
--peer-key-file=/opt/etcd/ssl/server-key.pem \
--trusted-ca-file=/opt/etcd/ssl/ca.pem \
--peer-trusted-ca-file=/opt/etcd/ssl/ca.pem
Restart=on-failure
LimitNOFILE=65536

[Install]
WantedBy=multi-user.target

在这里插入图片描述
修改成--initial-cluster-state=existing后开启服务

3、重启服务
将所有部署etcd的节点都重启etcd服务

systemctl restart etcd.service

然后在启动坏掉节点上的etcd服务

systemctl start etcd.service

在这里插入图片描述

Logo

开源、云原生的融合云平台

更多推荐