Stay organized with collections
Save and categorize content based on your preferences.
Mount external volumes
This topic explains how to mount additional volumes to a workload migrated with
Migrate to Containers. You might want to do this when your workload depends on
an external volume that is not copied to a Persistent Volume.
To add external volumes to a Migrate to Containers workload:
Add the volume to the StatefulSet in spec.containers.volumeMounts. See
Kubernetes Volumes
for more information.
Mount the volume in the container at the mount point you would like. This
will vary depending on the container's operating system.
The example below mounts the volume emptydir to /tmp.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-28 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)."]]