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.