From 6f2d2542a63a5c561b35c78fb728d11954eca11a Mon Sep 17 00:00:00 2001 From: Junwei Zhao Date: Mon, 30 May 2022 14:23:01 +1000 Subject: [PATCH] Update etcd --- categories/apps/etcd.md | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/categories/apps/etcd.md b/categories/apps/etcd.md index c1c8aea..1022fb2 100644 --- a/categories/apps/etcd.md +++ b/categories/apps/etcd.md @@ -2,8 +2,11 @@ etcd is a strongly consistent, distributed key-value store that provides a reliable way to store data that needs to be accessed by a distributed system or cluster of machines. It gracefully handles leader elections during network partitions and can tolerate machine failure, even in the leader node. -## Tips +## Set up a ETCD cluster +https://github.com/kelseyhightower/kubernetes-the-hard-way/blob/master/docs/07-bootstrapping-etcd.md + +## Tips ### Make the k8s embedded single etcd to be a cluster @@ -21,3 +24,13 @@ sudo ETCDCTL_API=3 etcdctl make-mirror https://new_etcd_node:2379 --endpoints=ht ``` sudo ETCDCTL_API=3 etcdctl get --prefix=true "" -w json --endpoints=https://127.0.0.1:2379 --cacert=/new_etcd/ca.pem --cert=/new_etcd/etcd.pem --key=/new_etcd/etcd-key.pem ``` + +### Join another existing cluster + +1. Run the join command on an existing node, for instnace +``` +sudo ETCDCTL_API=3 etcdctl member add server-2 --peer-urls=https://192.168.1.xxx:2380 --endpoints=https://192.168.1.xxx:2379,https://192.168.1.xxx:2379 --cacert=/etc/etcd/ca.pem --cert=/etc/etcd/etcd.pem --key=/etc/etcd/etcd-key.pem +``` +2. Prepare for the configursations for the new node, and remember to set `--initial-cluster-state` to existing +3. Start the etcd service of the new node +