Mounting External Volumes

This topic explains how to mount additional volumes to a workload migrated with Migrate for Anthos. 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 for Anthos 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.
  3. Add the mount point to the HC_FORWARD_MOUNTS environment variable in the workload's YAML.

The example below mounts the volume emptydir to /tmp.

kind: StatefulSet
apiVersion: apps/v1beta1
metadata:
  name: liveapp1
  namespace: default
spec:
  serviceName: "liveapp1-svc"
  replicas: 1
  selector:
    matchLabels:
      app: liveapp1
  template:
    metadata:
      labels:
        app: liveapp1
      annotations:
        anthos-migrate.gcr.io/action: run
        anthos-migrate.gcr.io/source-type: vlsdisk
        anthos-migrate.gcr.io/source-pvc: csi-vlsdisk-test-pvc-101
    spec:
      initContainers:
      containers:
      - name: suitecrm-app
        image: anthos-migrate.gcr.io/v2k-run:v0.9.6
        volumeMounts:
        - name: emptydir
          mountPath: /tmp
        env:
          - name: "HC_FORWARD_MOUNTS"
            value: /tmp
      volumes:
      - name: emptydir
        emptyDir: {}
本頁內容對您是否有任何幫助?請提供意見:

傳送您對下列選項的寶貴意見...

這個網頁
Migrate for Anthos Documentation