Here is my persistent volume definition
apiVersion: v1
kind: PersistentVolume
metadata:
name: task-pv-volume
labels:
type: local
spec:
storageClassName: manual
capacity:
storage: 10Gi
accessModes:
- ReadWriteOnce
hostPath:
path: "/mnt/data"
Here is my persistent volume claim
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: task-pv-claim
spec:
storageClassName: manual
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 3Gi
Here is the pod I'm trying to deploy
apiVersion: v1
kind: Pod
metadata:
name: task-pv-pod
spec:
volumes:
- name: task-pv-storage
persistentVolumeClaim:
claimName: task-pv-claim
containers:
- name: task-pv-container
image: nginx
ports:
- containerPort: 80
name: "http-server"
volumeMounts:
- mountPath: "/usr/share/nginx/html"
name: task-pv-storage
When I try to deploy the pod using kubectl create -f task-pv-pod.yaml
, I get this error
failed to start container "52c5f707bb90d87b4178e8508d710ae0912d8ee7bdd7c4b9b802bd6b35f266de": Error response from daemon: error while creating mount source path '/mnt/data': mkdir /mnt/data: read-only file system: RunContainerError
I am following this guide https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/, I have another pod running with a different application, and wanted to apply persistent storage to that pod once I had this one up and running.