Let's start by looking at how we can attach volumes to our pods. The simplest kind of volume available emptyDir is just a temporary directory that is linked to the life cycle of a pod. When the volume is created, it is empty as the name suggests, and remains on the node until the pod is removed from the node. The data you store inside the volume does persist between pod restarts on the same node, so can be useful for processes that need to cache expensive computations on the filesystem, or for processes that checkpoint their progress. In Chapter 1, Google's Infrastructure for the Rest of Us, we discussed some other possible uses for an emptyDir volume to share files between different containers within a pod.
In this example, we are going to make use of an emptyDir volume to deploy an application that expects to write to the /data directory in a container where...