Persistent storage: How to mount a directory in Kubernetes? Persistent storage: How to mount a directory in Kubernetes? docker docker

Persistent storage: How to mount a directory in Kubernetes?


I want to specify the directory on the host that I need mounted in the pod

That should be documented here

A hostPath volume mounts a file or directory from the host node’s filesystem into your pod. This is not something that most Pods will need, but it offers a powerful escape hatch for some applications.

Warning:

The files or directories created on the underlying hosts are only writable by root. You either need to run your process as root in a privileged container or modify the file permissions on the host to be able to write to a hostPath volume

  volumes:  - name: test-volume    hostPath:      # directory location on host      path: /data      # this field is optional      type: Directory