etcdctl 사용 이유
master1이 down되면 master2가 리더가되어 etcd write 권한을 얻게 된다. 그리고 관련 정보도 sync 되어 ha 구성을 할 수 있다.
etcdctl 설치
ETCD_VER=v3.4.29
# choose either URL
GOOGLE_URL=https://storage.googleapis.com/etcd
GITHUB_URL=https://github.com/etcd-io/etcd/releases/download
DOWNLOAD_URL=${GOOGLE_URL}
rm -f /tmp/etcd-${ETCD_VER}-linux-amd64.tar.gz
rm -rf /tmp/etcd-download-test && mkdir -p /tmp/etcd-download-test
curl -L ${DOWNLOAD_URL}/${ETCD_VER}/etcd-${ETCD_VER}-linux-amd64.tar.gz -o /tmp/etcd-${ETCD_VER}-linux-amd64.tar.gz
tar xzvf /tmp/etcd-${ETCD_VER}-linux-amd64.tar.gz -C /tmp/etcd-download-test --strip-components=1
rm -f /tmp/etcd-${ETCD_VER}-linux-amd64.tar.gz
/tmp/etcd-download-test/etcd --version
/tmp/etcd-download-test/etcdctl version
상태체크
raft 알고리즘 리더 확인
root@master1:/home/kingelip# ETCDCTL_API=3 etcdctl -w table --endpoints=192.168.0.201:2379,192.168.0.202:2379,192.168.0.203:2379 --cacert /etc/kubernetes/pki/etcd/ca.crt --cert /etc/kubernetes/pki/etcd/server.crt --key /etc/kubernetes/pki/etcd/server.key endpoint status
+--------------------+------------------+---------+---------+-----------+-----------+------------+
| ENDPOINT | ID | VERSION | DB SIZE | IS LEADER | RAFT TERM | RAFT INDEX |
+--------------------+------------------+---------+---------+-----------+-----------+------------+
| 192.168.0.201:2379 | d289ffc8e8b8fb28 | 3.5.9 | 4.9 MB | false | 5 | 19686 |
| 192.168.0.202:2379 | 9b15c9f32bd2a8e5 | 3.5.9 | 4.9 MB | true | 5 | 19686 |
| 192.168.0.203:2379 | 579cf073e803f698 | 3.5.9 | 4.9 MB | false | 5 | 19686 |
+--------------------+------------------+---------+---------+-----------+-----------+------------+
노드 상태 확인
root@master1:/home/kingelip# ETCDCTL_API=3 etcdctl -w table --endpoints=192.168.0.201:2379,192.168.0.202:2379,192.168.0.203:2379 --cacert /etc/kubernetes/pki/etcd/ca.crt --cert /etc/kubernetes/pki/etcd/server.crt --key /etc/kubernetes/pki/etcd/server.key endpoint health
192.168.0.202:2379 is healthy: successfully committed proposal: took = 995.585µs
192.168.0.203:2379 is healthy: successfully committed proposal: took = 1.402737ms
192.168.0.201:2379 is healthy: successfully committed proposal: took = 983.423µs
'기타정보' 카테고리의 다른 글
[정보] kubernetes 외부통신 적용(metallb) (0) | 2024.01.18 |
---|---|
[정보] kubernetes 관리도구 k9s 설치 (0) | 2024.01.18 |
[정보] kubernetes 사용에 도움되는 ansible playbook (0) | 2024.01.18 |
[정보] kubernetes 트러블 슈팅 (0) | 2024.01.18 |
[정보] ubuntu 20.04 쿠버네티스 한방 설치(containerd/keepalived) - (단일구성/다중구성) (0) | 2024.01.17 |