Unable to write into K8S mounted volume

505 views
Skip to first unread message

Kubernetes user discussion and Q&A

unread,
Aug 11, 2017, 8:59:25 AM8/11/17
to Kubernetes user discussion and Q&A
I am trying to mount a directory from the local VM onto my pod and write into it.

Local directory on my VM is 

/app/logs/


The directory I want to write it in on my pod is 

/logs


My RC config is :

apiVersion: v1
kind
: ReplicationController
metadata
:
  name
: servicemix-controller
spec
:
  replicas
: 1
  selector
:
    name
: servicemix
 
template:
    metadata
:
      labels
:
        name
: servicemix
    spec
:
      containers
:
     
- name: servicemix
        image
: docker:image1
        imagePullPolicy
: IfNotPresent
        ports
:
         
- containerPort: 8101
        volumeMounts
:
         
- name: logs
            mountPath
: "/logs"
      volumes
:
       
- name: logs
          nfs
:
            server
: kube-nfs
            path
: "/app/logs"

When I bring up my Pod, I see that the drive is mounted onto my Pod and I can access it BUT I cannot write into it.



[root@servicemix-controller-65w88 ~]# df -h
Filesystem              Size  Used Avail Use% Mounted on
overlay                  
99G  5.8G   89G   7% /
tmpfs                    16G     0   16G   0% /
dev
tmpfs                    
16G     0   16G   0% /sys/fs/cgroup
kube
-nfs:/kubenfs/logs   25G  3.8G   20G  16% /logs
/
dev/mapper/rhel-var     99G  5.8G   89G   7% /etc/hosts
shm                      
64M     0   64M   0% /dev/shm
[root@servicemix-controller-65w88 ~]# cd /logs/

[root@servicemix-controller-65w88 logs]# touch test
touch
: cannot touch 'test': Permission denied

I have also tries using readOnly: false but that does not work aswell. What else could I be missing ? 

Rodrigo Campos

unread,
Aug 11, 2017, 1:36:24 PM8/11/17
to kubernet...@googlegroups.com
If you are using NFS, then you should configure the NFS (IIRC
/etc/exports, but it's been some years now :-D) with proper
permissions. Have you done that too?
> --
> You received this message because you are subscribed to the Google Groups
> "Kubernetes user discussion and Q&A" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to kubernetes-use...@googlegroups.com.
> To post to this group, send email to kubernet...@googlegroups.com.
> Visit this group at https://groups.google.com/group/kubernetes-users.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages