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:

  1. Add the volume to the StatefulSet in spec.containers.volumeMounts . See Kubernetes Volumes for more information.
  2. 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

Create a Mobile Website
View Site in Mobile | Classic
Share by: