Hi,
 
Kubernetes emptyDir type volumes (
https://kubernetes.io/docs/concepts/storage/volumes/#emptydir) share their lifespan with the pod they are provisioned for. These volumes are available as long as the pod is running. As of now, Kubelet provisions the tmpfs backed emptyDir type volumes and then containers of the respective pod just bind mount the path from the host. One of the main uses of emptyDir type volume for facilitating the communication between the containers of the same pod. 
 
 
 
Considering the tight coupling between an individual pod and a corresponding emptyDir type volume, when you consider sandboxing the pod it only makes sense to have this emptyDir volume provisioned inside the confines of the sandbox. This way the communication between the containers of the pod is subjected to the same level of isolation or hardening as the containers themselves. 
 
 
This way all the containers are running inside the virtual machine plus all the contents of the emptyDir type volume stays within the confines of the virtual machine. This can be further helpful in future with Intel's TME and MKTME, IBM Ultravisor or AMD SEV. Since those technologies allow you to encrypt the memory pages used by VM, it will also mean that the contents of the emptyDir volumes will also remain encrypted from the host point of view. 
 
By the time pod is created, Kubelet already provisions the emptyDir type volume on the host. This volume is then bind mounted to the containers of the pod. If we want to introduce sandboxing for the pod the components responsible for provisioning the pod have (e.g. an OCI complaint runtime) no way to know if the particular mount is backed by emptyDir type volume. This is why you would notice that in our work in Kata depends on parsing the path of the storage ((
https://github.com/kata-containers/runtime/blob/master/cli/utils.go#L58) which is a less than desirable approach. 
 
 
We think the right way to handle emptyDir type volumes in sandboxed (or non sandboxed) pod is to handle the provisioning of the emptyDir type volumes by CRI. This way any CRI implementation for provisioning sandboxed (or non sandboxed) pods can also provision emptyDir type volumes in proper confines of the pod (VM or non VM)
 
We think we should fit emptyDir type volumes in CRI  at,
 
e.g.
<snip1>
message PodSandboxConfig {
<snip2>
    repeated string empty_dir = 9
</snip2>
}
</snip1>
 
I will be happy to know what the community thinks about this. 
 
Thanks,