<p>I am using the following snippet to create the deployment </p>

<pre><code>oc create -f nginx-deployment.yaml

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: nginx-deployment
  labels:
    app: nginx
spec:
  replicas: 1
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
      annotations:
        openshift.io/scc: privileged
    spec:
      securityContext:
        priviledged: false
        runAsUser: 0
      volumes:
      - name: static-web-volume
        hostPath:
          path: /home/testFolder
          type: Directory
      containers:
      - name: nginx
        image: nginx:1.7.9
        ports:
        - containerPort: 80
        volumeMounts:
        - mountPath: /usr/share/nginx/html 
          name: static-web-volume
</code></pre>

<p>I am getting permission denied issue when i try to go inside the  html folder</p>

<pre><code>$ cd /usr/share/nginx/html                                                                                                                                                                                                             
$ ls                                                                                                                                                                                                                                   
ls: cannot open directory .: Permission denied
</code></pre>

<p>This is easiest sample code as i have similar requirement where i have to read the files from the mounted drives, but that one is failing as well. </p>

<p>I am using kubernetes 1.5 as this is only one available. I am not sure whether the volumes have been mounted or not.<br>
all my dir permissions are set to root as well. </p>

<p>content of /home/testfolder
<code>
0 drwxrwxrwx. 3 root root 52 Apr 15 23:06 . 
4 dr-xr-x---. 11 root root 4096 Apr 15 22:58 .. 
0 drwxrwxrwx. 2 root root 6 Apr 15 19:56 ind 
4 -rwxrwxrwx. 1 root root 14 Apr 15 19:22 index.html 
4 -rwxrwxrwx. 1 root root 694 Apr 15 23:06 ordr.yam
</code></p>

<p>I remember hitting this one in openshift sometime back. It has something to do with SElinux configuration on the host.    </p>

<p>Try this at the host server where you mount to your container volume /usr/share/nginx/html. </p>

<p>sudo chcon -Rt svirt_sandbox_file_t /</p>
