prometheus-operator: Grafana error using persisten storage

kubernetes 1.10.3 with granafa 5.2.1 in AKS on a clean kube-prometheus install

 GF_PATHS_DATA='/var/lib/grafana' is not writable.
You may have issues with file permissions, more information here: http://docs.grafana.org/installation/docker/#migration-from-a-previous-version-of-the-docker-container-to-5-1-or-later
mkdir: cannot create directory '/var/lib/grafana/plugins': Permission denied 

My config:

grafana:
  image:
    tag: 5.2.1

  storageSpec:
    class: default
    accessMode: "ReadWriteOnce"
    resources:
      requests:
        storage: 2Gi

I guess related to url in error msg: http://docs.grafana.org/installation/docker/#user-id-changes

rel: #966 #541

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 18 (6 by maintainers)

Most upvoted comments

Im currently experiencing this GF_PATHS_DATA=‘/var/lib/grafana’ is not writable in kubernetes. I already added the 472 permission but still get the error. Here is my yaml file

kind: Deployment
metadata:
  name: grafana-ewan
  namespace: grafana
spec:
  replicas: 1
  selector:
    matchLabels:
      app: grafana
  template:
    metadata:
      name: grafana
      labels:
        app: grafana
    spec:
      securityContext:
            runAsUser: 472
            fsGroup: 472
      containers:
      - name: grafana
        # command: ['sh', '-c', 'chown -R 472:472 /var/lib/grafana']
        image: grafana/grafana:5.4.2
        ports:
        - name: grafana
          containerPort: 3000
        resources:
          limits:
            memory: "2Gi"
            cpu: "1000m"
          requests:
            memory: "1Gi"
            cpu: "500m"
        volumeMounts:
          - mountPath: /var/lib/grafana
            name: grafana-storage
          - mountPath: /etc/grafana/provisioning/datasources
            name: grafana-datasources
            readOnly: false
      volumes:
        - name: grafana-storage
          hostPath:
                  path: /home/ec2-user
                  type: Directory
          #persistentVolumeClaim:
          #        claimName: allow
        - name: grafana-datasources
          configMap:
              defaultMode: 420
              name: grafana-datasources
      nodeSelector:
               node: host1