자격증/CKA

[CKA] Udemy Lightning Lab (6/7)

14ben 2024. 7. 29. 23:02
728x90
Take the backup of ETCD at the location /opt/etcd-backup.db on the controlplane node.

- Troubleshoot and fix the issues

 

 

Volume snapshot

If etcd is running on a storage volume that supports backup, such as Amazon Elastic Block Store, back up etcd data by creating a snapshot of the storage volume.

Snapshot using etcdctl options

We can also create the snapshot using various options given by etcdctl. For example:

ETCDCTL_API=3 etcdctl -h 

will list various options available from etcdctl. For example, you can create a snapshot by specifying the endpoint, certificates and key as shown below:

ETCDCTL_API=3 etcdctl --endpoints=https://127.0.0.1:2379 \
  --cacert=<trusted-ca-file> --cert=<cert-file> --key=<key-file> \
  snapshot save <backup-file-location>

 

 

controlplane /opt ➜  kubectl describe -n kube-system pod/etcd-controlplane 
Name:                 etcd-controlplane
Namespace:            kube-system
...
..
.
Containers:
  etcd:
    Container ID:  containerd://103ca923155bbac4001039b76942128ffa5aa846dc272c4aa06845ba88380d78
    Image:         registry.k8s.io/etcd:3.5.10-0
    Image ID:      registry.k8s.io/etcd@sha256:22f892d7672adc0b9c86df67792afdb8b2dc08880f49f669eaaa59c47d7908c2
    Port:          <none>
    Host Port:     <none>
    Command:
      etcd
      --advertise-client-urls=https://192.32.232.9:2379
      --cert-file=/etc/kubernetes/pki/etcd/server.crt
      --client-cert-auth=true
      --data-dir=/var/lib/etcd
      --experimental-initial-corrupt-check=true
      --experimental-watch-progress-notify-interval=5s
      --initial-advertise-peer-urls=https://192.32.232.9:2380
      --initial-cluster=controlplane=https://192.32.232.9:2380
      --key-file=/etc/kubernetes/pki/etcd/server.key
      --listen-client-urls=https://127.0.0.1:2379,https://192.32.232.9:2379
      --listen-metrics-urls=http://127.0.0.1:2381
      --listen-peer-urls=https://192.32.232.9:2380
      --name=controlplane
      --peer-cert-file=/etc/kubernetes/pki/etcd/peer.crt
      --peer-client-cert-auth=true
      --peer-key-file=/etc/kubernetes/pki/etcd/peer.key
      --peer-trusted-ca-file=/etc/kubernetes/pki/etcd/ca.crt
      --snapshot-count=10000
      --trusted-ca-file=/etc/kubernetes/pki/etcd/ca.crt
    State:          Running
      ...
      ..
      .

 

 

controlplane /opt ✖ 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/etcd-backup.db
Snapshot saved at /opt/etcd-backup.db

 

 

 

 

 

https://kubernetes.io/docs/tasks/administer-cluster/configure-upgrade-etcd/#snapshot-using-etcdctl-options

 

Operating etcd clusters for Kubernetes

etcd is a consistent and highly-available key value store used as Kubernetes' backing store for all cluster data. If your Kubernetes cluster uses etcd as its backing store, make sure you have a back up plan for the data. You can find in-depth information a

kubernetes.io

 

 

728x90

'자격증 > CKA' 카테고리의 다른 글

Udemy Mock Exam - 1  (0) 2024.07.30
[CKA] Udemy Lightning Lab (7/7)  (0) 2024.07.29
[CKA] Udemy Lightning Lab (5/7)  (0) 2024.07.25
[CKA] Udemy Lightning Lab (4/7)  (0) 2024.07.24
[CKA] Udemy Lightning Lab (3/7)  (0) 2024.07.24