Volume mount configuration

The "manifest.json" file gives you the possibility to mount several volumes to a pod. You can find the different types of volumes on this link.

Volumes

The configuration of a volume is divided into two parts.

volume

Represents the volume configuration and its source. Composed of two keys :

name : (Required) The name that will be assigned to the volume on the pod

volumeSource : (Required) The source of the volume. The name of the key must match the source type. See example below

volumeMount

Represents the configuration of the mount.

Composed of :

mountPath : (Required) Path within the container at which the volume should be mounted. Must not contain ':'.

name : (Auto) This must match the Name of a Volume. It is automatically configured according to the volume name

readOnly : (Optional) Mounted read-only if true, read-write otherwise (false or unspecified). Defaults to false.

subPath : (Optional) Path within the volume from which the container’s volume should be mounted. Defaults to "" (volume’s root).

mountPropagation : (Optional) mountPropagation determines how mounts are propagated from the host to container and the other way around. When not set, MountPropagationNone is used.

Possible values :

None

MountPropagationNone means that the volume in a container will not receive new mounts from the host or other containers, and filesystems mounted inside the container won't be propagated to the host or other containers. Note that this mode corresponds to "private" in Linux terminology.

HostToContainer

MountPropagationHostToContainer means that the volume in a container will eceive new mounts from the host or other containers, but filesystems mounted inside the container won't be propagated to the host or other containers. Note that this mode is recursively applied to all mounts in the volume ("rslave" in Linux terminology).

Bidirectional

MountPropagationBidirectional means that the volume in a container will receive new mounts from the host or other containers, and its own mounts will be propagated from the container to the host or other containers. Note that this mode is recursively applied to all mounts in the volume ("rshared" in Linux terminology).

Examples

ConfigMap

This example represents a service on which a ConfigMap volume is mounted.

{
    "labels": "app:flask",
    "type": "service",
    "published" : {
	"access": "basic",
    	"prefix": "/flask-app/"
	},
    "name": "app-flask",
    "image-source": "quay.io/gilles/flask-team",
    "image-destination": "",
    "env": [],
    "cmd": [],
    "replicas": 1,
    "name-port": "app-port",
    "container-port": 5000,
  	"volumes": [
        {
            "volume": {
                "name": "name-of-volume",
                "configMap": {
                    "name": "source-configmap-name"
                }
            },
            "volumeMount": {
                "mountPath": "/mount-path"
            }
        }
    ]
}

GcePersistentDisk

This example represents a service on which a GcePersistentDisk is mounted.

{
    "labels": "app:flask",
    "type": "service",
    "published" : {
	"access": "basic",
    	"prefix": "/flask-app/"
	},
    "name": "app-flask",
    "image-source": "quay.io/gilles/flask-team",
    "image-destination": "",
    "env": [],
    "cmd": [],
    "replicas": 1,
    "name-port": "app-port",
    "container-port": 5000,
  	"volumes": [
        {
            "volume": {
                "name": "name-of-volume",
                "gcePersistentDisk": {
                    "pdName": "name-of-gcepersistentdisk",
                    "fsType": "ext4"
                }
            },
            "volumeMount": {
                "mountPath": "/mount-path"
            }
        }
    ]
}

Several volumes

You can mount multiple volumes to a pod by adding them one after the other.

{
    "labels": "app:flask",
    "type": "service",
    "published" : {
	"access": "basic",
    	"prefix": "/flask-app/"
	},
    "name": "app-flask",
    "image-source": "quay.io/gilles/flask-team",
    "image-destination": "",
    "env": [],
    "cmd": [],
    "replicas": 1,
    "name-port": "app-port",
    "container-port": 5000,
  	"volumes": [
        {
            "volume": {
                "name": "name-of-volume",
                "configMap": {
                    "name": "source-configmap-name"
                }
            },
            "volumeMount": {
                "mountPath": "/mount-path"
            }
        },
        {
            "volume": {
                "name": "name-of-volume",
                "gcePersistentDisk": {
                    "pdName": "name-of-gcepersistentdisk",
                    "fsType": "ext4"
                }
            },
            "volumeMount": {
                "mountPath": "/mount-path"
            }
        }
    ]
}