Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Externe Volumes bereitstellen
In diesem Thema wird erläutert, wie Sie zusätzliche Volumes zu einer mit Migrate to Containers migrierten Arbeitslast bereitstellen. Dies kann sinnvoll sein, wenn die Arbeitslast von einem externen Volume abhängt, das nicht in ein nichtflüchtiges Volume kopiert wird.
So fügen Sie externe Volumes zu einer Arbeitslast mit Migrate to Containers hinzu:
Fügen Sie das Volume dem StatefulSet in spec.containers.volumeMounts hinzu. Weitere Informationen finden Sie unter Kubernetes-Volumes.
Stellen Sie das Volume am gewünschten Bereitstellungspunkt im Container bereit. Dieser variiert je nach Betriebssystem des Containers.
Im folgenden Beispiel wird das Volume emptydir in /tmp bereitgestellt.
[[["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)."],[],[],null,["# Mount external volumes\n======================\n\nThis topic explains how to mount additional volumes to a workload migrated with\nMigrate to Containers. You might want to do this when your workload depends on\nan external volume that is not copied to a Persistent Volume.\n\nTo add external volumes to a Migrate to Containers workload:\n\n1. Add the volume to the `StatefulSet` in `spec.containers.volumeMounts`. See [Kubernetes Volumes](https://kubernetes.io/docs/concepts/storage/volumes/) for more information.\n2. Mount the volume in the container at the mount point you would like. This will vary depending on the container's operating system.\n\nThe example below mounts the volume `emptydir` to `/tmp`. \n\n apiVersion: apps/v1\n kind: StatefulSet\n metadata:\n creationTimestamp: null\n labels:\n app: app-my-vm-instance-1\n migrate-for-anthos-type: workload\n name: app-my-vm-instance-1\n spec:\n replicas: 1\n selector:\n matchLabels:\n app: app-my-vm-instance-1\n migrate-for-anthos-type: workload\n serviceName: app-my-vm-instance-1\n template:\n metadata:\n creationTimestamp: null\n labels:\n app: app-my-vm-instance-1\n migrate-for-anthos-type: workload\n spec:\n containers:\n - image: gcr.io/my-project/my-vm-instance-1:v1.0.0\n name: app-my-vm-instance-1\n readinessProbe:\n exec:\n command:\n - /code/ready.sh\n resources: {}\n securityContext:\n privileged: true\n volumeMounts:\n - name: emptydir\n mountPath: /tmp\n - mountPath: /sys/fs/cgroup\n name: cgroups\n - mountPath: /code/config/logs/\n name: logs-config\n - mountPath: /\u003cfolder\u003e\n name: pvc-my-vm-instance-1\n subPath: \u003cfolder\u003e\n volumes:\n - name: emptydir\n emptyDir: {}\n - hostPath:\n path: /sys/fs/cgroup\n type: Directory\n name: cgroups\n - configMap:\n name: app-my-vm-instance-1\n name: logs-config\n - name: pvc-my-vm-instance-1\n persistentVolumeClaim:\n claimName: pvc-my-vm-instance-1\n updateStrategy: {}\n status:\n replicas: 0\n\nWhat's next\n-----------\n\n- Learn how to [deploy a Linux workload to a target cluster](/migrate/containers/docs/deploying-to-target-cluster)."]]