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
inspec.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
.
apiVersion: apps/v1
kind: StatefulSet
metadata:
creationTimestamp: null
labels:
app: app-my-vm-instance-1
migrate-for-anthos-type: workload
name: app-my-vm-instance-1
spec:
replicas: 1
selector:
matchLabels:
app: app-my-vm-instance-1
migrate-for-anthos-type: workload
serviceName: app-my-vm-instance-1
template:
metadata:
creationTimestamp: null
labels:
app: app-my-vm-instance-1
migrate-for-anthos-type: workload
spec:
containers:
- image: gcr.io/my-project/my-vm-instance-1:v1.0.0
name: app-my-vm-instance-1
readinessProbe:
exec:
command:
- /code/ready.sh
resources: {}
securityContext:
privileged: true
volumeMounts:
- name: emptydir
mountPath: /tmp
- mountPath: /sys/fs/cgroup
name: cgroups
- mountPath: /code/config/logs/
name: logs-config
- mountPath: /<folder>
name: pvc-my-vm-instance-1
subPath: <folder>
volumes:
- name: emptydir
emptyDir: {}
- hostPath:
path: /sys/fs/cgroup
type: Directory
name: cgroups
- configMap:
name: app-my-vm-instance-1
name: logs-config
- name: pvc-my-vm-instance-1
persistentVolumeClaim:
claimName: pvc-my-vm-instance-1
updateStrategy: {}
status:
replicas: 0
What's next
Linux
Migrate
Deploy
- Review generated artifacts.
- Configure logging.
- Mounting external volumes.
- Deploy a workload to a target cluster.
- Deploy migrated VMs.
- Post-migration image updates.
- Monitor migrated workload.
- Test your migrate app and validate the migration.
Windows
Migrate
Deploy
- Deploy a workload to a target cluster.
- Deploy migrated VMs.
- Monitor migrated workload.
- Test your migrate app and validate the migration.
Tomcat
Migrate
Deploy
- Deploy a workload to a target cluster.
- Deploy migrated VMs.
- Monitor migrated workload.
- Test your migrate app and validate the migration.
WebSphere
Migrate
- Migration overview.
- Requirements.
- Before you begin.
- Add a migration source.
- Create a migration plan.
- Migrate data.
- Customize the migration plan.
- Execute the migration.
- Monitor the migration.
- Build an app container image.
- Deploy an app container to a target cluster.
- Delete a migration.
- Troubleshooting.
Deploy
- Deploy a workload to a target cluster.
- Deploy migrated VMs.
- Monitor migrated workload.
- Test your migrate app and validate the migration.
JBoss
Migrate
Deploy
- Deploy a workload to a target cluster.
- Deploy migrated VMs.
- Monitor migrated workload.
- Test your migrate app and validate the migration.
Apache
Migrate
Deploy
- Deploy a workload to a target cluster.
- Deploy migrated VMs.
- Monitor migrated workload.
- Test your migrate app and validate the migration.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2023-03-20 UTC.
[{
"type": "thumb-down",
"id": "hardToUnderstand",
"label":"Hard to understand"
},{
"type": "thumb-down",
"id": "incorrectInformationOrSampleCode",
"label":"Incorrect information or sample code"
},{
"type": "thumb-down",
"id": "missingTheInformationSamplesINeed",
"label":"Missing the information/samples I need"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Other"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Easy to understand"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Solved my problem"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Other"
}]