반응형
2023.05.20
★ 클러스터에서 실행 중인 ETCD의 버전은 무엇인가요?
-> etcd-version : 3.5.6
controlplane ~ ➜ kubectl -n kube-system logs etcd-controlplane | grep -i 'etcd-version'
{"level":"info","ts":"2023-05-20T05:14:33.291Z","caller":"embed/etcd.go:306","msg":"starting an etcd server","etcd-version":"3.5.6","git-sha":"cecbe35ce","go-version":"go1.16.15","go-os":"linux","go-arch":"amd64","max-cpu-set":36,"max-cpu-available":36,"member-initialized":false,"name":"controlplane","data-dir":"/var/lib/etcd","wal-dir":"","wal-dir-dedicated":"","member-dir":"/var/lib/etcd/member","force-new-cluster":false,"heartbeat-interval":"100ms","election-timeout":"1s","initial-election-tick-advance":true,"snapshot-count":10000,"max-wals":5,"max-snapshots":5,"snapshot-catchup-entries":5000,"initial-advertise-peer-urls":["https://192.6.237.3:2380"],"listen-peer-urls":["https://192.6.237.3:2380"],"advertise-client-urls":["https://192.6.237.3:2379"],"listen-client-urls":["https://127.0.0.1:2379","https://192.6.237.3:2379"],"listen-metrics-urls":["http://127.0.0.1:2381"],"cors":["*"],"host-whitelist":["*"],"initial-cluster":"controlplane=https://192.6.237.3:2380","initial-cluster-state":"new","initial-cluster-token":"etcd-cluster","quota-backend-bytes":2147483648,"max-request-bytes":1572864,"max-concurrent-streams":4294967295,"pre-vote":true,"initial-corrupt-check":true,"corrupt-check-time-interval":"0s","compact-check-time-enabled":false,"compact-check-time-interval":"1m0s","auto-compaction-mode":"periodic","auto-compaction-retention":"0s","auto-compaction-interval":"0s","discovery-url":"","discovery-proxy":"","downgrade-check-interval":"5s"}
controlplane ~ ➜
★ controlplane node에서 ETCD 클러스터에 연결할 수 있는 주소는 어디인가요?
-> https://127.0.0.1:2379
controlplane ~ ➜ kubectl -n kube-system describe pod etcd-controlplane | grep -i 'listen-client-url'
--listen-client-urls=https://127.0.0.1:2379,https://192.6.237.3:2379
controlplane ~ ➜
★ ETCD 서버 인증서 파일은 어디에 있나요?
-> --cert-file=/etc/kubernetes/pki/etcd/server.crt
controlplane ~ ➜ kubectl -n kube-system describe pod etcd-controlplane | grep -i 'cert-file'
--cert-file=/etc/kubernetes/pki/etcd/server.crt
--peer-cert-file=/etc/kubernetes/pki/etcd/peer.crt
controlplane ~ ➜
★ ETCD CA 인증서 파일은 어디에 있나요?
-> --peer-trusted-ca-file=/etc/kubernetes/pki/etcd/ca.crt
controlplane ~ ➜ kubectl -n kube-system describe pod etcd-controlplane | grep -i 'ca-file'
--peer-trusted-ca-file=/etc/kubernetes/pki/etcd/ca.crt
--trusted-ca-file=/etc/kubernetes/pki/etcd/ca.crt
controlplane ~ ➜
★ 클러스터의 master node는 오늘 밤에 재부팅이 예정되어 있습니다. 문제가 발생할 것으로 예상되지는 않지만 필요한 백업을 수행해야 합니다. 기본 제공 스냅샷 기능을 사용하여 ETCD 데이터베이스의 스냅샷을 만듭니다.
ETCDCTL_API=3 etcdctl --endpoints=https://[127.0.0.1]:2379 \
--cacert=/etc/kubernetes/pki/etcd/ca.crt \
--cert=/etc/kubernetes/pki/etcd/server.crt \
--key=/etc/kubernetes/pki/etcd/server.key \
snapshot save /opt/snapshot-pre-boot.db
controlplane ~ ➜ ETCDCTL_API=3 etcdctl --endpoints=https://[127.0.0.1]:2379 \
> --cacert=/etc/kubernetes/pki/etcd/ca.crt \
> --cert=/etc/kubernetes/pki/etcd/server.crt \
> --key=/etc/kubernetes/pki/etcd/server.key \
> snapshot save /opt/snapshot-pre-boot.db
Snapshot saved at /opt/snapshot-pre-boot.db
controlplane ~ ➜ ls /opt/
cni containerd snapshot-pre-boot.db
controlplane ~ ➜
★ 재부팅 후 마스터 노드가 다시 온라인 상태가 되었지만 애플리케이션에 액세스할 수 없습니다. 클러스터의 애플리케이션 상태를 확인하세요. 무슨 문제인가요?
- 배포가 없습니다.
- 서비스가 존재하지 않음
- 파드가 없음
위의 모든 것
★ 백업 파일을 사용하여 클러스터의 원래 상태를 복원합니다.
controlplane ~ ➜ ETCDCTL_API=3 etcdctl --data-dir /var/lib/etcd-from-backup \
> snapshot restore /opt/snapshot-pre-boot.db
2023-05-20 02:06:58.280313 I | mvcc: restore compact to 2461
2023-05-20 02:06:58.287347 I | etcdserver/membership: added member 8e9e05c52164694d [http://localhost:2380] to cluster cdf818194e3a8c32
반응형
'Kubernetes > Kubernetes Exam' 카테고리의 다른 글
[K8s] CKA 취득 연습문제#6 (csr approve, reject) (0) | 2023.05.30 |
---|---|
[K8s] CKA 취득 연습문제#5 (etcd, apiserver 인증서) (0) | 2023.05.29 |
[K8s] CKA 취득 연습문제#4 (etcd backup, recovery) (0) | 2023.05.24 |
[K8s] CKA 취득 연습문제#2 (node upgrade) (0) | 2023.05.17 |
[K8s] CKA 취득 연습문제#1 (cordor, drain) (0) | 2023.05.17 |