Defining Volumes

Volumes are created by specifying information about the Volume in the .spec.volumes field inside a Pod manifest file. The following manifest snippet will create a Volume of type hostPath, using the parameters defined in the path and type properties.

hostPath is the Volume type most similar to a Docker Volume, where the Volume exists as a directory from the host node's filesystem:

apiVersion: v1kind: Podspec:  ...  volumes:  - name: host-volume    hostPath:      path: /data      type: Directory

This Volume will now be available to all containers within the Pod. However, the Volume is not automatically mounted onto each container. This is done by design because not all containers may need to use the Volume; it allows the configuration to be ...

Get Building Enterprise JavaScript Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.