From 029f5bf9d8f62ff4f2773656dfb2ef83d010d369 Mon Sep 17 00:00:00 2001 From: Junwei Zhao Date: Wed, 4 Oct 2023 11:04:01 +1100 Subject: [PATCH] update --- cluster.yaml | 2 +- etcd.service | 2 +- etcd.sh | 7 ++++++- install/etcd.sh | 11 +++++++---- recovery.sh | 10 ++++++++++ 5 files changed, 25 insertions(+), 7 deletions(-) mode change 100644 => 100755 etcd.sh diff --git a/cluster.yaml b/cluster.yaml index d8b4507..19652c8 100644 --- a/cluster.yaml +++ b/cluster.yaml @@ -25,7 +25,6 @@ apiServer: timeoutForControlPlane: 4m0s apiVersion: kubeadm.k8s.io/v1beta3 certificatesDir: /etc/kubernetes/pki -clusterName: home-cluster controlPlaneEndpoint: 192.168.1.2:6443 controllerManager: {} dns: {} @@ -37,6 +36,7 @@ etcd: - https://192.168.1.10:2379 - https://192.168.1.11:2379 - https://192.168.1.2:2379 + - https://192.168.1.6:2379 keyFile: /etc/etcd/etcd-key.pem kind: ClusterConfiguration kubernetesVersion: v1.26.0 diff --git a/etcd.service b/etcd.service index b51b49b..8181f83 100644 --- a/etcd.service +++ b/etcd.service @@ -21,7 +21,7 @@ ExecStart=/usr/local/bin/etcd \\ --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 server-3=https://192.168.1.2:2380,ssd-server-1=https://192.168.1.111:2380,ssd-server-3=https://192.168.1.9:2380 \\ + --initial-cluster server-3=https://192.168.1.2:2380,ssd-server-2=https://192.168.1.10:2380,plex=https://192.168.1.11:2380,ssd-server-4=https://192.168.1.6:2380 \\ --initial-cluster-state existing \\ --data-dir=/var/lib/etcd Restart=on-failure diff --git a/etcd.sh b/etcd.sh old mode 100644 new mode 100755 index 0ffc464..701c85b --- a/etcd.sh +++ b/etcd.sh @@ -5,8 +5,13 @@ sudo ETCDCTL_API=3 etcdctl member list \ --cert=/etc/etcd/etcd.pem \ --key=/etc/etcd/etcd-key.pem -# member add +# member add from an existing node sudo ETCDCTL_API=3 etcdctl member add server-3 --peer-urls=https://192.168.1.2:2380 --endpoints=https://127.0.0.1:2379 --cacert=/etc/etcd/ca.pem --cert=/etc/etcd/etcd.pem --key=/etc/etcd/etcd-key.pem # get all keys sudo ETCDCTL_API=3 etcdctl get --prefix=true "" -w json --endpoints=https://127.0.0.1:2379 --cacert=/etc/etcd/ca.pem --cert=/etc/etcd/etcd.pem --key=/etc/etcd/etcd-key.pem + + +# remove a member + + sudo ETCDCTL_API=3 etcdctl member remove 3f3a73a30a4872c4 --endpoints=https://127.0.0.1:2379 --cacert=/etc/etcd/ca.pem --cert=/etc/etcd/etcd.pem --key=/etc/etcd/etcd-key.pem diff --git a/install/etcd.sh b/install/etcd.sh index 17edd96..7b73462 100644 --- a/install/etcd.sh +++ b/install/etcd.sh @@ -3,12 +3,15 @@ # Update HOST0, HOST1 and HOST2 with the IPs of your hosts export HOST0=192.168.1.2 export HOST1=192.168.1.11 -export HOST2=192.168.1.111 +export HOST2=192.168.1.10 +export HOST2=192.168.1.6 # Update NAME0, NAME1 and NAME2 with the hostnames of your hosts -export NAME0="server-1" +export NAME0="server-3" export NAME1="plex" -export NAME2="ssd-server-1" +export NAME2="ssd-server-2" +export NAME3="ssd-server-4" + # Create temp directories to store files that will end up on other hosts. mkdir -p /tmp/${HOST0}/ /tmp/${HOST1}/ /tmp/${HOST2}/ @@ -37,7 +40,7 @@ etcd: peerCertSANs: - "${HOST}" extraArgs: - initial-cluster: ${NAMES[0]}=https://${HOSTS[0]}:2380,${NAMES[1]}=https://${HOSTS[1]}:2380,${NAMES[2]}=https://${HOSTS[2]}:2380 + initial-cluster: ${NAMES[0]}=https://${HOSTS[0]}:2380,${NAMES[1]}=https://${HOSTS[1]}:2380,${NAMES[2]}=https://${HOSTS[2]}:2380,${NAMES[3]}=https://${HOSTS[3]}:2380 initial-cluster-state: new name: ${NAME} listen-peer-urls: https://${HOST}:2380 diff --git a/recovery.sh b/recovery.sh index 4700009..1c5c1bb 100644 --- a/recovery.sh +++ b/recovery.sh @@ -165,3 +165,13 @@ https://computingforgeeks.com/install-cri-o-container-runtime-on-ubuntu-linux/ https://kubernetes.io/docs/setup/production-environment/container-runtimes/#cgroup-driver # install kubeadm and kublet + +# install some old version of a package + +apt list --all-versions kubeadm + +# then install + +sudo apt install kubeadm=1.27.6-00 + +# Datadog crash probably related to redis, please make sure redis is healthy