|
|
| (One intermediate revision by the same user not shown) |
| Line 1: |
Line 1: |
| <syntaxhighlight>
| |
| INTERNAL_IP=$(ifconfig ens4 | grep -v inet6 |grep 'inet' | tr -s ' ' | cut -d' ' -f3)
| |
| cat <<EOF | sudo tee /etc/systemd/system/etcd.service
| |
| [Unit]
| |
| Description=etcd
| |
| Documentation=https://github.com/coreos
| |
|
| |
|
| [Service]
| |
| Type=notify
| |
| ExecStart=/usr/local/bin/etcd \\
| |
| --name ${ETCD_NAME} \\
| |
| --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 \\
| |
| --peer-client-cert-auth \\
| |
| --client-cert-auth \\
| |
| --initial-advertise-peer-urls https://${INTERNAL_IP}:2380 \\
| |
| --listen-peer-urls https://${INTERNAL_IP}:2380 \\
| |
| --listen-client-urls https://${INTERNAL_IP}:2379,https://127.0.0.1:2379 \\
| |
| --advertise-client-urls https://${INTERNAL_IP}:2379 \\
| |
| --initial-cluster-token etcd-cluster-0 \\
| |
| --initial-cluster us-etcd-01=https://10.1.20.11:2380,us-etcd-02=https://10.1.20.12:2380,us-etcd-03=https://10.1.20.10:2380 \\
| |
| --initial-cluster-state new \\
| |
| --data-dir=/var/lib/etcd
| |
| Restart=on-failure
| |
| RestartSec=5
| |
|
| |
| [Install]
| |
| WantedBy=multi-user.target
| |
| EOF
| |
| </syntaxhighlight>
| |