Skip to content

Instantly share code, notes, and snippets.

@nuBacuk
Last active September 18, 2019 11:24
Show Gist options
  • Select an option

  • Save nuBacuk/9cc403c7ea9c203c40f60d8ac8af564d to your computer and use it in GitHub Desktop.

Select an option

Save nuBacuk/9cc403c7ea9c203c40f60d8ac8af564d to your computer and use it in GitHub Desktop.
Commands ETCD
ETCDCTL_API=3 etcdctl --endpoints=https://172.27.10.136:2379,https://172.27.10.137:2379,https://172.27.10.138:2379 --cacert /etc/kubernetes/pki/etcd/ca.crt --cert /etc/kubernetes/pki/etcd/peer.crt --key /etc/kubernetes/pki/etcd/peer.ke
y endpoint status -w table

+----------------------------+------------------+---------+---------+-----------+-----------+------------+
|          ENDPOINT          |        ID        | VERSION | DB SIZE | IS LEADER | RAFT TERM | RAFT INDEX |
+----------------------------+------------------+---------+---------+-----------+-----------+------------+
| https://172.27.10.136:2379 | fd6543c20e28d267 |  3.3.10 |  4.5 MB |      true |      3983 |    3041667 |
| https://172.27.10.137:2379 | 9d230288279f239e |  3.3.10 |  4.4 MB |     false |      3983 |    3041667 |
| https://172.27.10.138:2379 |  50d8b1b2d2933be |  3.3.10 |  4.4 MB |     false |      3983 |    3041666 |
+----------------------------+------------------+---------+---------+-----------+-----------+------------+

./etcd --name infra0 --initial-advertise-peer-urls http://172.27.10.106:2380 \ 
--listen-peer-urls http://172.27.10.106:2380 \
--listen-client-urls http://172.27.10.106:2379,http://127.0.0.1:2379 \
--advertise-client-urls http://172.27.10.106:2379 \
--initial-cluster-token etcd-cluster-1 \
--initial-cluster infra0=http://172.27.10.106:2380,infra1=http://172.27.1.233:2380 \
--initial-cluster-state new

Добавление ноды в кластер

ETCDCTL_API=3 ./etcdctl member add infra2 --peer-urls=http://172.27.10.104:2380 --endpoints=http://172.27.10.106:2379,http://172.27.1.233:237

Запустить новую ноду

./etcd --name infra2 --initial-advertise-peer-urls http://172.27.10.104:2380 --listen-peer-urls http://172.27.10.104:2380 --listen-client-urls http://172.27.10.104:2379,http://127.0.0.1:2379  --advertise-client-urls http://172.27.10.104:2379 --initial-cluster-token etcd-cluster-1 --initial-cluster infra2=http://172.27.10.104:2380,infra1=http://172.27.1.233:2380,infra0=http://172.27.10.106:2380 --initial-cluster-state existing
em etcdctl endpoint status -w table --endpoints https://172.27.10.103:2379,https://172.27.10.104:2379,https://172.27.10.106:2379,https://172.27.10.131:2379,https://172.27.10.132:2379
/ # ETCDCTL_API=3 etcdctl --endpoints=https://172.27.10.136:2379,https://172.27.10.137:2379,https://172.27.10.138:2379,https://172.27.10.139:2379,https://172.27.10.106:2379 --cacert /etc/kubernetes/pki/etcd/ca.crt --cert /etc/kubernetes/pki/etcd/peer.crt --key /etc/kubernetes/pki/etcd/peer.key endpoint status -w table
Failed to get the status of endpoint https://172.27.10.139:2379 (context deadline exceeded)
Failed to get the status of endpoint https://172.27.10.106:2379 (context deadline exceeded)
+----------------------------+------------------+---------+---------+-----------+-----------+------------+
|          ENDPOINT          |        ID        | VERSION | DB SIZE | IS LEADER | RAFT TERM | RAFT INDEX |
+----------------------------+------------------+---------+---------+-----------+-----------+------------+
| https://172.27.10.136:2379 | fd6543c20e28d267 |  3.3.10 |  9.5 MB |     false |     20277 |    6262040 |
| https://172.27.10.137:2379 | 9d230288279f239e |  3.3.10 |  9.4 MB |     false |     20277 |    6262040 |
| https://172.27.10.138:2379 |  50d8b1b2d2933be |  3.3.10 |  9.5 MB |      true |     20277 |    6262040 |
+----------------------------+------------------+---------+---------+-----------+-----------+------------+

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