Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Auf dieser Seite wird erläutert, wie Sie eine Kopie oder einen Snapshot eines Speichervolumes zu einem bestimmten Zeitpunkt für Ihre Containeranwendung erstellen. Mit einem Volume-Snapshot können Sie ein Volume auf einen vorherigen Zustand zurücksetzen oder ein neues Volume bereitstellen.
Diese Seite richtet sich an Entwickler in der Gruppe der Anwendungsbetreiber, die für die Erstellung von Anwendungsarbeitslasten für ihre Organisation verantwortlich sind. Weitere Informationen finden Sie in der Dokumentation zu Zielgruppen für GDC-Air-Gap-Umgebungen.
Hinweise
Wenn Sie Befehle für einen Kubernetes-Cluster ausführen möchten, benötigen Sie die folgenden Ressourcen:
Suchen Sie den Namen des Kubernetes-Clusters oder fragen Sie Ihren Plattformadministrator danach.
Verwenden Sie den kubeconfig-Pfad des Kubernetes-Clusters, um KUBERNETES_CLUSTER_KUBECONFIG in dieser Anleitung zu ersetzen.
Bitten Sie Ihren IAM-Administrator der Organisation, Ihnen die Rolle „Namespace Admin“ (namespace-admin) in Ihrem Projekt-Namespace zuzuweisen, um die erforderlichen Berechtigungen zum Verwalten von Volume-Snapshots zu erhalten.
Volume-Snapshot erstellen
Wenn Sie einen Snapshot eines PersistentVolumeClaim-Objekts erstellen möchten, erstellen Sie ein VolumeSnapshot-Objekt. Das System garantiert keine Datenkonsistenz. Halten Sie die Anwendung an und leeren Sie die Daten, bevor Sie einen Snapshot erstellen.
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Schwer verständlich","hardToUnderstand","thumb-down"],["Informationen oder Beispielcode falsch","incorrectInformationOrSampleCode","thumb-down"],["Benötigte Informationen/Beispiele nicht gefunden","missingTheInformationSamplesINeed","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2025-09-04 (UTC)."],[[["\u003cp\u003eVolume snapshots allow you to create a point-in-time copy of a volume for restoration or provisioning new volumes, and in Kubernetes, they are managed through the \u003ccode\u003eVolumeSnapshot\u003c/code\u003e object.\u003c/p\u003e\n"],["\u003cp\u003eBefore taking a volume snapshot, ensure you have the Kubernetes cluster name and its kubeconfig file, and also need the Namespace Admin role permissions in your project namespace.\u003c/p\u003e\n"],["\u003cp\u003eTaking a volume snapshot requires creating a \u003ccode\u003eVolumeSnapshot\u003c/code\u003e object, specifying the \u003ccode\u003ePersistentVolumeClaim\u003c/code\u003e to snapshot, using a \u003ccode\u003ekubectl\u003c/code\u003e command with your cluster's kubeconfig and replacing placeholder variables.\u003c/p\u003e\n"],["\u003cp\u003eYou can check the snapshot's status using a specific \u003ccode\u003ekubectl\u003c/code\u003e command, and it is ready when the \u003ccode\u003e.status.readyToUse\u003c/code\u003e field is \u003ccode\u003etrue\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eTo restore a volume from a snapshot, update the \u003ccode\u003ePersistentVolumeClaim\u003c/code\u003e manifest to specify the snapshot as the data source, referencing the \u003ccode\u003eVolumeSnapshot\u003c/code\u003e name and other details.\u003c/p\u003e\n"]]],[],null,["# Create volume snapshots\n\nThis page explains how to create a copy, or snapshot, of a storage volume at a\nspecific point in time for your container application. A volume snapshot lets\nyou bring a volume back to a prior state or provision a new volume.\n\nThis page is for developers within the application operator group, who are\nresponsible for creating application workloads for their organization. For more\ninformation, see\n[Audiences for GDC air-gapped documentation](/distributed-cloud/hosted/docs/latest/gdch/resources/audiences).\n\nBefore you begin\n----------------\n\nTo run commands against a\n[Kubernetes cluster](/distributed-cloud/hosted/docs/latest/gdch/platform/pa-user/clusters#cluster-architecture),\nmake sure you have the following resources:\n\n1. Locate the Kubernetes cluster name, or ask your Platform Administrator what\n the cluster name is.\n\n2. [Sign in and generate](/distributed-cloud/hosted/docs/latest/gdch/application/ao-user/iam/sign-in#zonal-cluster-kubeconfig)\n the kubeconfig file for the Kubernetes cluster if you don't have one.\n\n3. Use the kubeconfig path of the Kubernetes cluster to replace\n \u003cvar translate=\"no\"\u003eKUBERNETES_CLUSTER_KUBECONFIG\u003c/var\u003e in these instructions.\n\nTo get the required permissions to manage volume snapshots, ask your\nOrganization IAM Admin to grant you the Namespace Admin role (`namespace-admin`)\nin your project namespace.\n\nTake a volume snapshot\n----------------------\n\nTo take a snapshot of a `PersistentVolumeClaim` object, create a\n`VolumeSnapshot` object. The system does not guarantee data consistency. Pause\nthe application and flush data before taking a snapshot.\n\n1. Create a `VolumeSnapshot` custom resource:\n\n kubectl --kubeconfig \u003cvar translate=\"no\"\u003eKUBERNETES_CLUSTER_KUBECONFIG\u003c/var\u003e \\\n --namespace \u003cvar translate=\"no\"\u003eNAMESPACE\u003c/var\u003e apply -f - \u003c\u003cEOF\n apiVersion: snapshot.storage.k8s.io/v1\n kind: VolumeSnapshot\n metadata:\n name: \u003cvar translate=\"no\"\u003eVOLUME_SNAPSHOT_NAME\u003c/var\u003e\n spec:\n source:\n persistentVolumeClaimName: \u003cvar translate=\"no\"\u003ePVC_NAME\u003c/var\u003e\n EOF\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eKUBERNETES_CLUSTER_KUBECONFIG\u003c/var\u003e: the kubeconfig file for\n the cluster.\n\n - \u003cvar translate=\"no\"\u003eNAMESPACE\u003c/var\u003e: the project namespace in which to create the\n volume snapshot.\n\n - \u003cvar translate=\"no\"\u003eVOLUME_SNAPSHOT_NAME\u003c/var\u003e: the `VolumeSnapshot` object\n name.\n\n - \u003cvar translate=\"no\"\u003ePVC_NAME\u003c/var\u003e: the name of the PVC for which you are\n creating a snapshot.\n\n2. The snapshot operation is complete when the `.status.readyToUse` field\n becomes `true`. You can use the following command to check the status:\n\n kubectl --kubeconfig \u003cvar translate=\"no\"\u003eKUBERNETES_CLUSTER_KUBECONFIG\u003c/var\u003e get volumesnapshot \\\n -o custom-columns='NAME:.metadata.name,READY:.status.readyToUse'\n\n3. Update the PVC manifest with the volume snapshot specified as a data\n source:\n\n kubectl --kubeconfig \u003cvar translate=\"no\"\u003eKUBERNETES_CLUSTER_KUBECONFIG\u003c/var\u003e \\\n --namespace \u003cvar translate=\"no\"\u003eNAMESPACE\u003c/var\u003e apply -f - \u003c\u003cEOF\n apiVersion: v1\n kind: PersistentVolumeClaim\n metadata:\n name: \u003cvar translate=\"no\"\u003ePVC_NAME\u003c/var\u003e\n spec:\n dataSource:\n name: \u003cvar translate=\"no\"\u003eVOLUME_SNAPSHOT_NAME\u003c/var\u003e\n kind: VolumeSnapshot\n apiGroup: snapshot.storage.k8s.io\n storageClassName: standard-rwo\n accessModes:\n - ReadWriteOnce\n resources:\n requests:\n storage: 10Gi\n EOF\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eKUBERNETES_CLUSTER_KUBECONFIG\u003c/var\u003e: the kubeconfig file for\n the cluster.\n\n - \u003cvar translate=\"no\"\u003eNAMESPACE\u003c/var\u003e: the namespace in which the PVC\n resource exists.\n\n - \u003cvar translate=\"no\"\u003ePVC_NAME\u003c/var\u003e: the name of the PVC for which you are\n creating a snapshot.\n\n - \u003cvar translate=\"no\"\u003eVOLUME_SNAPSHOT_NAME\u003c/var\u003e: the name of the volume\n snapshot.\n\nWhat's next\n-----------\n\n- [Container workloads overview](/distributed-cloud/hosted/docs/latest/gdch/application/ao-user/containers/containers-intro)\n- [Create stateful workloads](/distributed-cloud/hosted/docs/latest/gdch/application/ao-user/containers/create-stateful-workloads)\n- [Access persistent storage](/distributed-cloud/hosted/docs/latest/gdch/application/ao-user/containers/access-persistent-storage)"]]