As I mainly want to use Kubernetes to orchestrate my containers, I don’t use multiple nodes. I consider that paying for an external storage solution while I have enough disk space on the host machine is wasting money. I host my Kubernetes cluster on a Vultr VPS.
Note that I could have done it with Docker compose to, but I prefer K8s. Using K8s also allows me to quickly change my cluster to a multi-node cluster if I decide to. Also, managing multiple projects on the same cluster with namespaces and multiple yaml files is easier.
The official documentation is available here.
Here is a basic deployment file with the HostPath volume.
It’s fairly esay to mount a volume from the Host. However, this solution is generally a bad idea for multi-nodes clusters, the Pods can be scheduled to a different node and no longer have access to the directory/file. Prefer using the PVCs for this use cases.