I have a Kubernetes cluster with one node (docker-desktop). The cluster has a default storage class hostpath
and created a PV as well as a corresponding PVC making use of hostpath
storage class. The PVC has successfully bound to a running pod.
As I understand, hostpath
makes use of the node's file system as a storage location that pods can use to store files in.
My question is how can I manually access to store files to the node's file system so that the files may be accessible by the running pod?
Please find my PV:
apiVersion: v1
kind: PersistentVolume
metadata:
name: mps-pv
spec:
accessModes:
- ReadWriteOnce
capacity:
storage: 20Gi
persistentVolumeReclaimPolicy: Retain
storageClassName: hostpath
hostPath:
path: /mnt/mps/
And my PVC
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: mps-pv-claim
namespace: mps
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 20Gi
storageClassName: hostpath
volumeName: mps-pv
PS: I am new to Kubernetes so my question may not even be relevant here.
You will need to install kubectl
on your local OS and configure it to connect to the docker desktop Kubernetes cluster. Then you can use the command kubectl cp
to copy your files to the storage, by connecting to the pod that is already running and has access to that storage.