问题汇总

etcd错误总结

Linux · 8月17日 · 2020年

部署etcd错误总结

conflicting environment variable "ETCD_NAME" is shadowed by corresponding command-line flag (either unset environment variable or disable flag)

原因:ETCD3.4版本会自动读取环境变量的参数,所以EnvironmentFile文件中有的参数,不需要再次在ExecStart启动参数中添加,二选一,如同时配置,会触发以下类似错是因

etcd.conf配置文件参数变量

#[Member]
ETCD_NAME="etcd01"
ETCD_DATA_DIR="/var/lib/etcd/default.etcd"
ETCD_LISTEN_PEER_URLS="https://192.168.3.63:2380"
ETCD_LISTEN_CLIENT_URLS="https://192.168.3.63:2379"

#[Clustering]
ETCD_INITIAL_ADVERTISE_PEER_URLS="https://192.168.3.63:2380"
ETCD_ADVERTISE_CLIENT_URLS="https://192.168.3.63:2379"
ETCD_INITIAL_CLUSTER="etcd01=https://192.168.3.63:2380,etcd02=https://192.168.3.64:2380,etcd03=https://192.168.3.65:2380,etcd04=https://192.168.3.66:2380"
ETCD_INITIAL_CLUSTER_TOKEN="etcd-cluster"
ETCD_INITIAL_CLUSTER_STATE="new"

解决过程:

删除红色多余变量即可

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

[Service]
Type=notify
EnvironmentFile=/opt/etcd/cfg/etcd.conf
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
Restart=on-failure
LimitNOFILE=65536

[Install]
WantedBy=multi-user.target

error 220;remote error: tls: bad certificate”;, ServerName ̶0;”

解答:证书拒绝链接,证书问题重新生成即可

问题:

ETCD集群环境搭建三节点,其中一台宕机。重新部署删除原有/var/lib/etcd/default.etcd目录下数据。

recognized environment variable ETCD_NAME, but unused: shadowed by corresponding flagconflicting environment variable "ETCD_NAME" is shadowed by corresponding command-line flag (either unset environment variable or disable flag)

解决办法

ETCD_INITIAL_CLUSTER_STATE="existing"

说明:原节点设置为ETCD_INITIAL_CLUSTER_STATE=̶1;newR21;,新节点设置设置ETCD_INITIAL_CLUSTER_STATE="existing"然后启动。

ETCD集群报错以下报错,问题导致:防火墙、selinux

[root@kuberneteus-master ~]# kubectl get cs
NAME                 STATUS      MESSAGE                                                                                       ERROR
controller-manager   Healthy     ok                                                                                            
scheduler            Healthy     ok                                                                                            
etcd-0               Healthy     {"health":"true"}                                                                             
etcd-1               Healthy     {"health":"true"}                                                                             
etcd-2               Unhealthy   Get https://192.168.3.17:2379/health: dial tcp 192.168.3.17:2379: connect: no route to host   

解决:

关闭IPTABLES防火

centos7

systemctl stop firewalld

centos6

/etc/init.d/iptables stop

关闭SELINUX

永久

vim /etc/sysconfig/selinux

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three two values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected.
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

临时

setenforce 0

 

0 条回应