apiVersion: batch/v1
kind: Job
metadata:
  name: grafana-storage-chown
  namespace: metrics
spec:
  template:
    spec:
      restartPolicy: Never
      containers:
      - name: grafana-storage-chown
        # grep runAsUser tmp/kube-prometheus/manifests/grafana-deployment.yml
        command: ["/bin/sh", "-c"]
        args:
        - set -x;
          ls -lah /var/lib/grafana;
          chown -R 65534:65534 /var/lib/grafana;
          ls -lah /var/lib/grafana;
          mount;
          df -h;
        image: busybox:latest
        volumeMounts:
        - name: grafana-storage
          mountPath: /var/lib/grafana
      volumes:
      - name: grafana-storage
        persistentVolumeClaim:
          claimName: grafana-storage
