0

I'm running a Kubernetes 1.8.4 cluster on Azure (populated with acs-engine v0.10).

I need to run a Redis pod with data persistency, so I'm using persistentVolume / persistentVolumeClaim with azurefile storageClass so that Redis can save to that volume.

Problem is that Redis container is running with redis:redis user and that Kubernetes mounts the volume with a root:root ownership and 0700 access mode.

=> So Redis can't write to that volume and dies.

Normally I'd fix this with mountOptions, but I fear this option is not supported for AzureFiles as per Kubernetes documentation:

Note: Not all Persistent volume types support mount options.

Did anybody ever managed to mount AzureFiles volumes in a Kubernetes pod with non-root access ? If so, I'd love to know how :-)

TIA!

Olivier Dauby
  • 235
  • 1
  • 3
  • 9

2 Answers2

0

An alternative solution from Azure is to mount the azurefile as a persistent volume claim. https://docs.microsoft.com/en-us/azure/aks/azure-files-volume#mount-file-share-as-an-persistent-volume

uid, gid along with file system permissions can be passed (0777).

Personally, tried and it tested!

peeyushsrj
  • 101
  • 1
0

After reviewing this providential CloudBees blog post, it turned out that mountOptions are supported for azurefile, it's just that I needed to create a dedicated StorageClass and consume it via a PersistentVolumeClaim.

---
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: redis-sc
  annotations:
  labels:
    kubernetes.io/cluster-service: 'true'
provisioner: kubernetes.io/azure-file
parameters:
reclaimPolicy: 'Delete'
mountOptions:
  - "uid=999,gid=999"
Olivier Dauby
  • 235
  • 1
  • 3
  • 9