Produk yang dijelaskan dalam dokumentasi ini, Cluster Anthos di AWS (generasi sebelumnya), kini berada dalam mode pemeliharaan. Semua penginstalan baru harus menggunakan produk generasi saat ini, cluster Anthos di AWS.
Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Halaman ini menunjukkan cara mencadangkan penyimpanan data etcd untuk penginstalan GKE di AWS Anda untuk pemulihan dari peristiwa yang dapat merusak data etcd cluster Anda.
Batasan
Menggunakan file cadangan untuk memulihkan data etcd adalah upaya terakhir. Sebaiknya jangan memulihkan dari file cadangan kecuali jika cluster benar-benar rusak. Hubungi dukungan Google untuk mendapatkan bantuan dalam memutuskan tindakan terbaik.
Prosedur ini tidak mencadangkan data dari workload Anda, termasuk
PersistentVolume.
Cadangan ini tidak dapat digunakan untuk memulihkan cluster dari versi GKE di AWS yang berbeda.
Mencadangkan cluster pengguna
Pencadangan cluster pengguna adalah snapshot penyimpanan etcd cluster pengguna.
Penyimpanan etcd berisi semua objek Kubernetes dan objek kustom yang merepresentasikan status cluster. Snapshot berisi
data yang diperlukan untuk membuat ulang workload stateless cluster.
Untuk membuat snapshot penyimpanan data etcd, lakukan langkah-langkah berikut:
Buka shell di instance layanan pengelolaan yang menjalankan etcd untuk cluster Anda.
Temukan alamat IP instance layanan pengelolaan cluster Anda.
Buat direktori untuk menyimpan data cadangan etcd.
mkdir ./etcd-backups
Gunakan alat command line ps untuk menemukan ID proses etcd
pada instance tersebut.
ps -e | grep etcd
Output akan menampilkan detail proses etcd Anda. Elemen pertama adalah ID proses etcd. Pada langkah-langkah berikut, ganti ETCD_PID dengan ID
proses ini.
Buat skrip dalam sistem file penampung etcd untuk mengambil snapshot.
Skrip ini menjalankan etcdctl untuk terhubung ke daemon etcd dan melakukan snapshot untuk mencadangkan database etcd.
cat << EOT > /tmp/etcdbackup.sh
# Extract a snapshot of the anthos-gke etcd state database
export ETCDCTL_API=3
etcdctl \
--endpoints=https://127.0.0.1:2379 \
--cacert=/secrets/server-ca.crt \
--cert=/secrets/server.crt \
--key=/secrets/server.key \
snapshot save /tmp/snapshot.db
EOT
chmod a+x /tmp/etcdbackup.sh
sudo mv /tmp/etcdbackup.sh /proc/ETCD_PID/root/tmp/etcdbackup.sh
Gunakan perintah nsenter untuk menjalankan skrip dalam container etcd guna membuat snapshot.
Salin semua file di direktori /secrets pada penampung etcd ke direktori cadangan Anda. File ini berisi sertifikat yang mengenkripsi dan memvalidasi
komunikasi antara etcd dan proses lain dalam cluster. Bersama-sama, file snapshot dan file sertifikat adalah cadangan penuh status cluster etcd Anda.
Gunakan alat tar untuk menggabungkan file etc-backup ke dalam file tar yang mudah digunakan.
tar -cvf etcd-backup.tar etcd-backup
Keluar ke komputer lokal Anda dan gunakan alat scp untuk menyalin file etcd-backup.tar dari instance layanan pengelolaan. Contoh ini menggunakan variabel lingkungan BASTION_DNS dan MANAGEMENT_IP yang ditentukan sebelumnya.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 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)"]]