During development of an application meant to be orchestrated by Kubemetes, you want to mount the /data directory on your laptop into a container.
Will this strategy successfully accomplish this?
Solution. Create a Persistent VolumeClaim requesting storageClass:'''' (which defaults to local storage) and hostPath and use this to populate a volume in a pod.
This strategy does successfully mount the /data directory on your laptop into a container. Creating a persistentVolumeClaim requesting storageClass:'''' (which defaults to local storage) and hostPath and using this to populate a volume in a pod is a valid way to mount a host directory into a container in Kubernetes. A persistentVolumeClaim is a request for storage by a user or an application. A persistentVolume is an abstraction that represents a piece of storage in the cluster. A storageClass is a type of storage with a specific provisioner and parameters. A hostPath volume allows you to mount a file or directory from the host node's filesystem into your pod. A local volume allows you to mount local storage devices such as disks or partitions into your pod. By creating a persistentVolumeClaim with storageClass:'''' and hostPath, you are requesting a piece of storage that is backed by a hostPath volume on the node where the pod is scheduled. By using this persistentVolumeClaim to populate a volume in a pod, you are mounting the host directory into the container in the pod. Reference: https://kubernetes.io/docs/concepts/storage/persistent-volumes/, https://kubernetes.io/docs/concepts/storage/storage-classes/, https://kubernetes.io/docs/concepts/storage/volumes/#hostpath, https://kubernetes.io/docs/concepts/storage/volumes/#local