opsnull / follow-me-install-kubernetes-cluster

和我一步步部署 kubernetes 集群
Other
7.45k stars 2.9k forks source link

部署启动etcd报错误 #554

Open SEC-nux opened 4 years ago

SEC-nux commented 4 years ago

文档版本 说明你查看的是哪个 branch 的文档,即 K8S 版本,如 v1.8、v1.12。

现象描述 部署启动etcd报错误! :50:11 CST, end at Wed 2019-11-13 13:34:00 CST. -- Nov 13 11:08:43 k8s-01 systemd[1]: [/etc/systemd/system/etcd.service:10] Not an absolute path, ignoring: ${ETCD_DATA_DIR} Nov 13 11:08:43 k8s-01 systemd[1]: [/etc/systemd/system/etcd.service:12] Unknown lvalue '--data-dir' in section 'Service' Nov 13 11:08:43 k8s-01 systemd[1]: [/etc/systemd/system/etcd.service:13] Unknown lvalue '--wal-dir' in section 'Service' Nov 13 11:08:43 k8s-01 systemd[1]: [/etc/systemd/system/etcd.service:14] Unknown lvalue '--name' in section 'Service' Nov 13 11:08:43 k8s-01 systemd[1]: [/etc/systemd/system/etcd.service:15] Unknown lvalue '--cert-file' in section 'Service' Nov 13 11:08:43 k8s-01 systemd[1]: [/etc/systemd/system/etcd.service:16] Unknown lvalue '--key-file' in section 'Service' Nov 13 11:08:43 k8s-01 systemd[1]: [/etc/systemd/system/etcd.service:17] Unknown lvalue '--trusted-ca-file' in section 'Service' Nov 13 11:08:43 k8s-01 systemd[1]: [/etc/systemd/system/etcd.service:18] Unknown lvalue '--peer-cert-file' in section 'Service' Nov 13 11:08:43 k8s-01 systemd[1]: [/etc/systemd/system/etcd.service:19] Unknown lvalue '--peer-key-file' in section 'Service' Nov 13 11:08:43 k8s-01 systemd[1]: [/etc/systemd/system/etcd.service:20] Unknown lvalue '--peer-trusted-ca-file' in section 'Service' Nov 13 11:08:43 k8s-01 systemd[1]: [/etc/systemd/system/etcd.service:21] Missing '='.

mdh67899 commented 4 years ago

你这个报错看起来是参数不对,或者环境变量没被替换,或者systemd文件写的有问题,启动脚本和配置文件贴一下看看?

mdh67899 commented 4 years ago
--data-dir=${ETCD_DATA_DIR} \
--wal-dir=${ETCD_WAL_DIR} \
--name=##NODE_NAME## \
--listen-peer-urls=https://##NODE_IP##:2380 \
--initial-advertise-peer-urls=https://##NODE_IP##:2380 \
--listen-client-urls=https://##NODE_IP##:2379,http://127.0.0.1:2379 \
--advertise-client-urls=https://##NODE_IP##:2379 \
--initial-cluster=${ETCD_NODES} \

@vincent081 这些配置的值都是变量,你systemd文件里要改成真实的值才能正常启动

mdh67899 commented 4 years ago

还有很多变量没改啊,你是不是没有执行source操作啊,生成的配置文件里变量没被替换

https://github.com/opsnull/follow-me-install-kubernetes-cluster/blob/master/04.%E9%83%A8%E7%BD%B2etcd%E9%9B%86%E7%BE%A4.md

source /opt/k8s/bin/environment.sh
cat > etcd.service.template <