이 페이지에서는 클러스터의 etcd 데이터를 손상시킬 수 있는 이벤트에서 복구하기 위해 GKE on AWS 설치용 etcd 데이터 스토어를 백업하는 방법을 보여줍니다.
제한사항
백업 파일을 사용한 etcd 데이터 복원은 최후의 수단으로 사용하는 것이 좋습니다. 클러스터가 완전히 손상되지 않는 한 백업 파일에서 복원하지 않는 것이 좋습니다. 최상의 조치를 결정하는 데 도움이 필요하면 Google 지원팀에 문의하세요.
이 절차에서는 PersistentVolume을 포함하여 워크로드의 데이터를 백업하지 않습니다.
이 백업은 다른 버전의 GKE on AWS를 복원하는 데 사용할 수 없습니다.
사용자 클러스터 백업
사용자 클러스터 백업은 사용자 클러스터 etcd 저장소의 스냅샷입니다.
etcd 저장소에는 클러스터의 상태를 나타내는 모든 Kubernetes 객체와 커스텀 객체가 포함됩니다. 스냅샷에는 클러스터의 스테이트리스(Stateless) 워크로드를 다시 만드는 데 필요한 데이터가 포함되어 있습니다.
etcd 컨테이너의 /secrets 디렉터리에 있는 모든 파일을 백업 디렉터리에 복사합니다. 이 파일에는 etcd와 클러스터의 다른 프로세스 간의 커뮤니케이션을 암호화하고 검증하는 인증서가 포함됩니다. 스냅샷 파일과 인증서 파일은 모두 etcd 클러스터 상태의 전체 백업입니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-07-31(UTC)"],[],[],null,["# Backing up user clusters on AWS\n\nThis page shows how to back up the etcd data store for your\nGKE on AWS installation for recovery from events that may\ndamage your cluster's etcd data.\n\nLimitations\n-----------\n\n- Using a backup file to restore your etcd data is a last resort. We do\n not recommend restoring from a backup file unless the cluster is completely\n broken. Contact Google support for help in deciding the best course of action.\n\n- This procedure does not back up data from your workloads, including\n PersistentVolumes.\n\n- This backup cannot be used to restore a cluster from a different version of\n GKE on AWS.\n\nBacking up a user cluster\n-------------------------\n\nA user cluster backup is a snapshot of the user cluster's etcd store.\nThe etcd store contains all of the Kubernetes objects and custom objects\nthat represent the cluster's state. The snapshot contains the\ndata required to recreate the cluster's stateless workloads.\n\nTo create a snapshot of the etcd data store, perform the following steps:\n\n1. Open a shell on the management service instance running etcd for your cluster.\n\n 1. Find the IP address of your cluster's management service instance.\n\n export CLUSTER_ID=$(terraform output cluster_id)\n export MANAGEMENT_IP=$(aws ec2 describe-instances \\\n --filters \"Name=tag:Name,Values=$CLUSTER_ID-management-0\" \\\n --query \"Reservations[*].Instances[*].PrivateIpAddress\" \\\n --output text)\n\n 2. Use the `ssh` tool to open a connection to the management service instance.\n\n ### Direct connection\n\n ssh -i ~/.ssh/anthos-gke ubuntu@$MANAGEMENT_IP\n\n ### Bastion host\n\n export BASTION_DNS=$(terraform output bastion_dns_name)\n ssh -i ~/.ssh/anthos-gke -J ubuntu@$BASTION_DNS ubuntu@$MANAGEMENT_IP\n\n | **Note:** If the \\`ssh\\` command fails with a public key permission error, you might need to refresh your ssh authentication key with the following command: \n |\n | ```\n | ssh-add -k ~/.ssh/anthos-gke\n | ```\n | Replace \u003cvar translate=\"no\"\u003eanthos-gke\u003c/var\u003e with the name of the file containing your authentication key.\n2. Create a directory to store the etcd backup data.\n\n ```\n mkdir ./etcd-backups\n ```\n3. Use the `ps` command-line tool to find the process ID of the etcd\n process on that instance.\n\n ```\n ps -e | grep etcd\n ```\n\n The output shows details of your etcd process. The first element is etcd's\n process ID. In the following steps, replace \u003cvar translate=\"no\"\u003eETCD_PID\u003c/var\u003e with this\n process ID.\n4. Create a script within the etcd container's filesystem to take a snapshot.\n This script runs etcdctl to connect to the etcd daemon and perform a snapshot to\n back up the etcd database.\n\n ```\n cat \u003c\u003c EOT \u003e /tmp/etcdbackup.sh\n # Extract a snapshot of the anthos-gke etcd state database\n\n export ETCDCTL_API=3\n\n etcdctl \\\n --endpoints=https://127.0.0.1:2379 \\\n --cacert=/secrets/server-ca.crt \\\n --cert=/secrets/server.crt \\\n --key=/secrets/server.key \\\n snapshot save /tmp/snapshot.db\n EOT\n\n chmod a+x /tmp/etcdbackup.sh\n sudo mv /tmp/etcdbackup.sh /proc/ETCD_PID/root/tmp/etcdbackup.sh\n ```\n5. Use the `nsenter` command to run the script within the etcd container to\n create the snapshot.\n\n ```\n sudo nsenter --all --target ETCD_PID /tmp/etcdbackup.sh\n ```\n6. Copy the snapshot file out of the etcd container.\n\n ```\n sudo cp /proc/ETCD_PID/root/tmp/snapshot.db ./etcd-backups\n ```\n7. Copy all files in the /secrets directory of the etcd container to your\n backup directory. These files contain the certificates that encrypt and validate\n communication between etcd and other processes in the cluster. Together, the\n snapshot file and the certificates files are a full backup of your\n etcd cluster status.\n\n ```\n sudo cp -r /proc/ETCD_PID/root/secrets ./etcd-backups\n ```\n8. Use the `tar` tool to bundle the etc-backup files into a convenient tar file.\n\n ```\n tar -cvf etcd-backup.tar etcd-backup\n ```\n9. Exit to your local machine and use the `scp` tool to copy the\n etcd-backup.tar file from the management service instance. This example uses\n the BASTION_DNS and MANAGEMENT_IP environment variables defined earlier.\n\n ```\n scp -i ~/.ssh/anthos-gke -J ubuntu@$BASTION_DNS \\\n ubuntu@$MANAGEMENT_IP:~/etcd-backup/backup.tar\n ```\n\n### For More Information\n\n- [scp man page](http://manpages.org/scp)\n- [etcdctl man page](http://manpages.org/etcdctl)\n- [tar man page](http://manpages.org/tar)"]]