GF_PATHS_DATA='/var/lib/grafana' is not writable

im currently experiencing this GF_PATHS_DATA=’/var/lib/grafana’ is not writable in kubernete.
i already added the 472 permission but still get the error. here is my yaml file. Im using the hostPath as my persistent volume

apiVersion: apps/v1
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

This seems more of a Kubernetes question than a Grafana one. You might have more luck by asking your question in a Kubernetes forum instead.

I disagree. When the installation documents describe an installation Yaml that doesn’t work with no explanation about volume permissions, then noobs get stopped before they have even started.

I understand volumes and permissions to an extent but it unclear what Grafana is trying to do and why it would fail out of the box like this, especially when copying the user permissions from the suggested yaml file.

It is likely only a documentation issue but ideally you should describe the PV required to work with the suggested PVC in terms of setting the permissions to work with what the container expects.

I didn’t realize OP referred to official documentation :pray:

Could you link to the installation YAML you’re referring to, and I’ll make sure to share your feedback with the docs team!