我在努力学习凯尔西·海塔的“艰难之路”教程。我已经退出了脚本,因为我试图在本地服务器上引导k8s。
但是,当我创建服务时,我得到了一个错误:
Failed to start etcd.service: Unit is not loaded properly: Bad message.
See system logs and 'systemctl status etcd.service' for details.
查看日志,我得到:
Jun 21 20:16:49 controller-0 systemd[1]: [/etc/systemd/system/etcd.service:9] Missing '='.
Jun 21 20:16:49 controller-0 systemd[1]: [/etc/systemd/system/etcd.service:9] Missing '='.
Jun 21 20:17:25 controller-0 systemd[1]: [/etc/systemd/system/etcd.service:9] Missing '='.
下面是etcd.service文件:
[Unit]
Description=etcd service
Documentation=https://github.com/coreos/etcd
[Service]
User=etcd
Type=notify
ExecStart=/usr/local/bin/etcd \\
--name ${ETCD_NAME} \\
--data-dir /var/lib/etcd \\
--initial-advertise-peer-urls http://${ETCD_HOST_IP}:2380 \\
--listen-peer-urls http://${ETCD_HOST_IP}:2380 \\
--listen-client-urls http://${ETCD_HOST_IP}:2379,http://127.0.0.1:2379 \\
--advertise-client-urls http://${ETCD_HOST_IP}:2379 \\
--initial-cluster-token etcd-cluster-1 \\
--initial-cluster etcd-1=http://192.168.0.7:2380 \\
--initial-cluster-state new \\
--heartbeat-interval 1000 \\
--election-timeout 5000
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target
发布于 2019-06-26 15:06:25
答案是迈克尔·汉普顿指出的。这两个反斜杠是因为代码应该是从终端(在指南中)编写的。在etcd.service文件中,行应该用一个单独的。
[Unit]
Description=etcd service
Documentation=https://github.com/coreos/etcd
[Service]
User=etcd
Type=notify
ExecStart=/usr/local/bin/etcd \
--name ${ETCD_NAME} \
--data-dir /var/lib/etcd \
--initial-advertise-peer-urls http://${ETCD_HOST_IP}:2380 \
--listen-peer-urls http://${ETCD_HOST_IP}:2380 \
--listen-client-urls http://${ETCD_HOST_IP}:2379,http://127.0.0.1:2379 \
--advertise-client-urls http://${ETCD_HOST_IP}:2379 \
--initial-cluster-token etcd-cluster-1 \
--initial-cluster etcd-1=http://192.168.0.7:2380 \
--initial-cluster-state new \
--heartbeat-interval 1000 \
--election-timeout 5000
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target
https://serverfault.com/questions/972465
复制相似问题