title: How to mount containers volume(non root user) to root user on host in Kubernetes?
body: <p>When i am trying to mount application log volume from containers to host
  getting error: Operation not permitted</p>
  
  <pre><code>spec:
    securityContext:
      runAsUser: 1000
      runAsGroup: 3000
      fsGroup: 2000
    initContainers:
    - name: volume-mount-permission
      image: xx.xx.xx.xx/orchestration/credit-card
      command:
      - sh
      - -c
      - chown -R 1000:1000 /opt/payara/appserver/glassfish/logs/credit-card
      - chgrp 1000 /opt/payara/appserver/glassfish/logs/credit-card
      volumeMounts:
      - name: card-corp-logs
        mountPath: /opt/payara/appserver/glassfish/logs/credit-card
        readOnly: false
  
    containers:
    - name: credit-card
      image: xx.xx.xx.xx/orchestration/credit-card
      imagePullPolicy: Always
      securityContext:
        privileged: true
        runAsUser: 1000
      ports:
      - name: credit-card
        containerPort: 8080
      readinessProbe:
        httpGet:
           path: /
           port: 8080
        initialDelaySeconds: 10
        periodSeconds: 5
        successThreshold: 1
      volumeMounts:
      - name: override-setting-storage
        mountPath: /p/config
      - name: credit-card-teamsite
        mountPath: /var/credit-card/teamsite/card_corp
  </code></pre>
  
  <p>Container Path - /opt/payara/appserver/glassfish/logs/credit-card to hostPath</p>
  
  <p>Can anyone please help me out where i am doing mistake in deployment yml file.</p>