使用此云配置来使用 vagrant 启动 coreos:
#cloud-config
coreos:
etcd2:
name: core-01
initial-advertise-peer-urls: http://$private_ipv4:2380
listen-peer-urls:
http://$private_ipv4:2380,http://$private_ipv4:7001
initial-cluster-token: core-01_etcd
initial-cluster: core-01=http://$private_ipv4:2380
initial-cluster-state: new
advertise-client-urls:
http://$public_ipv4:2379,http://$public_ipv4:4001
listen-client-urls: http://0.0.0.0:2379,http://0.0.0.0:4001
fleet:
public-ip: $public_ipv4
flannel:
interface: $public_ipv4
units:
- name: etcd2.service
command: start
- name: fleet.service
command: start
- name: flanneld.service
drop-ins:
- name: 50-network-config.conf
content: |
[Service]
ExecStartPre=/usr/bin/etcdctl set /coreos.com/network/config '{ "Network": "10.1.0.0/16" }'
command: start
- name: docker-tcp.socket
command: start
enable: true
content: |
[Unit]
Description=Docker Socket for the API
[Socket]
ListenStream=2375
Service=docker.service
BindIPv6Only=both
[Install]
WantedBy=sockets.target
etcd 无法启动:
systemctl status etcd
● etcd.service - etcd
Loaded: loaded (/usr/lib64/systemd/system/etcd.service; static; vendor preset: disabled)
Active: inactive (dead)
我在没有云配置的情况下在 Azure 上启动 CoreOS VM,它给了我同样的错误。
最佳答案
查看服务启动模式:
systemctl list-unit-files | grep etcd
应该启用它。
如果它被“屏蔽”
systemctl unmask etcd.service
如果是“禁用”
systemctl enable etcd.service
在云配置文件中,我们看到需要更多服务。 所以你可以使用
systemctl edit etcd.service --full
并编辑此服务文件:
[Unit]
#Description=etcd...
#...
#After=network.target
#e.g. Start this Service before etcd.service
Wants=flanneld.service
有关更详细的 systemctl 描述,请参阅:
https://www.digitalocean.com/community/tutorials/how-to-use-systemctl-to-manage-systemd-services-and-units
https://wiki.archlinux.org/index.php/Systemd
关于azure - etcd 无法启动 - 供应商预设 : disabled,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35503316/