Skip to content

Instantly share code, notes, and snippets.

@nicusX
Last active June 26, 2018 10:22
Show Gist options
  • Save nicusX/371824881f8d331d4529ceabd571e318 to your computer and use it in GitHub Desktop.
Save nicusX/371824881f8d331d4529ceabd571e318 to your computer and use it in GitHub Desktop.
# {{ ansible_managed }}
[Unit]
Description=etcd
Documentation=https://github.com/coreos
[Service]
ExecStart=/usr/bin/etcd --name {{ inventory_hostname }} \
--cert-file=/etc/etcd/kubernetes.pem \
--key-file=/etc/etcd/kubernetes-key.pem \
--peer-cert-file=/etc/etcd/kubernetes.pem \
--peer-key-file=/etc/etcd/kubernetes-key.pem \
--trusted-ca-file=/etc/etcd/ca.pem \
--peer-trusted-ca-file=/etc/etcd/ca.pem \
--initial-advertise-peer-urls https://{{ ansible_eth0.ipv4.address }}:2380 \
--listen-peer-urls https://{{ ansible_eth0.ipv4.address }}:2380 \
--listen-client-urls https://{{ ansible_eth0.ipv4.address }}:2379,http://127.0.0.1:2379 \
--advertise-client-urls https://{{ ansible_eth0.ipv4.address }}:2379 \
--initial-cluster-token etcd-cluster-0 \
--initial-cluster {% for node in groups['etcd'] %}{{ node }}=https://{{ hostvars[node].ansible_eth0.ipv4.address }}:2380{% if not loop.last %},{% endif %}{% endfor %} \
--initial-cluster-state new \
--data-dir=/var/lib/etcd
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target
@thienchuong
Copy link

Hi, when I type command "etcdctl cluster-health" to check etcd cluster. It's promt an error like this, could you help me. thanks
cluster may be unhealthy: failed to list members
Error: client: etcd cluster is unavailable or misconfigured
error #0: client: endpoint http://127.0.0.1:2379 exceeded header timeout
error #1: dial tcp 127.0.0.1:4001: getsockopt: connection refused

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment