follow-me-install-kubernetes-cluster
follow-me-install-kubernetes-cluster copied to clipboard
ETCD其他节点初始化失败
服务文件
[Unit] Description=Etcd Server After=network.target After=network-online.target Wants=network-online.target Documentation=https://github.com/coreos
[Service]
Type=notify
WorkingDirectory=/opt/etcd/data/
ExecStart=/opt/k8s/bin/etcd
--data-dir=/opt/etcd/data/
--wal-dir=/home/etcd/wal/
--name=zhangjun-k8s02
--cert-file=/etc/etcd/cert/etcd.pem
--key-file=/etc/etcd/cert/etcd-key.pem
--trusted-ca-file=/etc/kubernetes/cert/ca.pem
--peer-cert-file=/etc/etcd/cert/etcd.pem
--peer-key-file=/etc/etcd/cert/etcd-key.pem
--peer-trusted-ca-file=/etc/kubernetes/cert/ca.pem
--peer-client-cert-auth
--client-cert-auth
--listen-peer-urls=https://192.168.1.51:2380
--initial-advertise-peer-urls=https://192.168.1.51:2380
--listen-client-urls=https://192.168.1.51:2379,http://127.0.0.1:2379
--advertise-client-urls=https://192.168.1.51:2379
--initial-cluster-token=etcd-cluster-0
--initial-cluster=zhangjun-k8s01,zhangjun-k8s02
--initial-cluster-state=new
--auto-compaction-mode=periodic
--auto-compaction-retention=1
--max-request-bytes=33554432
--quota-backend-bytes=6442450944
--heartbeat-interval=250
--election-timeout=2000
Restart=on-failure
RestartSec=5
LimitNOFILE=65536
[Install] WantedBy=multi-user.target
报错内容
11月 27 17:44:16 zhangjun-k8s02 etcd[46592]: etcd Version: 3.4.3 11月 27 17:44:16 zhangjun-k8s02 etcd[46592]: [WARNING] Deprecated '--logger=capnslog' flag is set; use '--logger=zap' flag instead 11月 27 17:44:16 zhangjun-k8s02 etcd[46592]: [WARNING] Deprecated '--logger=capnslog' flag is set; use '--logger=zap' flag instead 11月 27 17:44:16 zhangjun-k8s02 etcd[46592]: Git SHA: 3cf2f69b5 11月 27 17:44:16 zhangjun-k8s02 etcd[46592]: Go Version: go1.12.12 11月 27 17:44:16 zhangjun-k8s02 etcd[46592]: Go OS/Arch: linux/amd64 11月 27 17:44:16 zhangjun-k8s02 etcd[46592]: setting maximum number of CPUs to 2, total number of available CPUs is 2 11月 27 17:44:16 zhangjun-k8s02 etcd[46592]: peerTLS: cert = /etc/etcd/cert/etcd.pem, key = /etc/etcd/cert/etcd-key.pem, trusted-ca = /etc/kubernetes/cert/ca.pem, client-cert-aut 11月 27 17:44:16 zhangjun-k8s02 etcd[46592]: The scheme of client url http://127.0.0.1:2379 is HTTP while peer key/cert files are presented. Ignored key/cert files. 11月 27 17:44:16 zhangjun-k8s02 etcd[46592]: The scheme of client url http://127.0.0.1:2379 is HTTP while client cert auth (--client-cert-auth) is enabled. Ignored client cert au 11月 27 17:44:16 zhangjun-k8s02 etcd[46592]: error setting up initial cluster: URL scheme must be http, https, unix, or unixs: 11月 27 17:44:16 zhangjun-k8s02 systemd[1]: etcd.service: main process exited, code=exited, status=1/FAILURE 11月 27 17:44:16 zhangjun-k8s02 systemd[1]: Failed to start Etcd Server.
重点这一句看不懂: error setting up initial cluster: URL scheme must be http, https, unix, or unixs:
--initial-cluster=zhangjun-k8s01,zhangjun-k8s02
这个参数配置格式有误,正确的应该是
--initial-cluster=zhangjun-k8s01=https://x.x.x.x:2380,zhangjun-k8s02=https://x.x.x.x:2380