# Read-only file system error in Kubernetes

**URL:** <https://discuss.kubernetes.io/t/read-only-file-system-error-in-kubernetes/11370>\
**Category:** General Discussions\
**Created:** [June 10, 2020, 7:15pm UTC](https://discuss.kubernetes.io/t/read-only-file-system-error-in-kubernetes/11370 "2020-06-10T19:15:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Siddhu1096](https://avatars.discourse-cdn.com/v4/letter/s/6a8cbe/32.png) [@Siddhu1096](https://discuss.kubernetes.io/u/Siddhu1096)\
**Post date:** [June 10, 2020, 7:15pm UTC](https://discuss.kubernetes.io/t/read-only-file-system-error-in-kubernetes/11370/1 "2020-06-10T19:15:46Z")

</div>

I am getting an error while adding NFS in the Kubernetes cluster. I was able to mount the NFS but not able to add a file or directory in the mount location.

This is my yaml file

```auto
kind: Pod
apiVersion: v1
metadata:
  name: pod-using-nfs
spec:
  volumes:
    - name: nfs-volume
      nfs:
        server: 10.01.26.81
        path: /nfs_data/nfs_share_home_test/testuser
  containers:
    - name: app
      image: alpine
      volumeMounts:
        - name: nfs-volume
          mountPath: /home/kube/testuser

```

Then I ran the following commands for building the pod

```auto
kubectl apply -f session.yaml
kubectl exec -it pod-using-nfs sh

```

After I exec to the pod,

```auto
/ # cd home/kube/testuser/
/home/kube/testuser# touch hello
touch: hello: Read-only file system

```

Expected output is

```auto
/ # cd home/kube/testuser/
/home/kube/testuser# touch hello
/home/kube/testuser# ls
hello

```

Should I need to add any securityContext to the yaml for fixing this?  
Any help would be appreciated!

---

<div class="post-metadata">

**Author:** ![tej-singh-rana](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/tej-singh-rana/32/5921_2.png) [@tej-singh-rana](https://discuss.kubernetes.io/u/tej-singh-rana)\
**Post date:** [June 11, 2020, 4:26am UTC](https://discuss.kubernetes.io/t/read-only-file-system-error-in-kubernetes/11370/2 "2020-06-11T04:26:47Z")

</div>

May be the reason is you haven’t define rw option in your NFS configuration in exportfs file?

---

<div class="post-metadata">

**Author:** ![Siddhu1096](https://avatars.discourse-cdn.com/v4/letter/s/6a8cbe/32.png) [@Siddhu1096](https://discuss.kubernetes.io/u/Siddhu1096)\
**Post date:** [June 11, 2020, 7:35pm UTC](https://discuss.kubernetes.io/t/read-only-file-system-error-in-kubernetes/11370/3 "2020-06-11T19:35:36Z")

</div>

> [@tej-singh-rana](#):
>
> u haven’t define rw option in your NFS

Thanks man. This issue is resolved!
