Closed aki0000 closed 3 years ago
Created pv and pvc for Grafana
apiVersion: apps/v1
kind: StatefulSet
metadata:
creationTimestamp: null
labels:
app: {{ .Release.Name }}
name: {{ .Release.Name }}
namespace: {{ .Release.Namespace }}
spec:
replicas: 1
serviceName: "grafana"
selector:
matchLabels:
app: {{ .Release.Name }}
template:
metadata:
creationTimestamp: null
labels:
app: {{ .Release.Name }}
spec:
securityContext:
runAsUser: 0
fsGroup: 472
containers:
- image: grafana/grafana
name: {{ .Release.Name }}
volumeMounts:
- name: grafana-prometheus-configmap
mountPath: "/etc/grafana/provisioning/datasources"
- name: {{ .Release.Name }}-storage
mountPath: /var/lib/grafana
env:
- name: GF_SECURITY_ADMIN_USER
value: "admin"
- name: GF_SECURITY_ADMIN_PASSWORD
value: "admin1234"
volumes:
- name: grafana-prometheus-configmap
configMap:
name: grafana-prometheus-datasource
- name: {{ .Release.Name }}-storage
persistentVolumeClaim:
claimName: {{ .Release.Name }}-pvc
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: {{ .Release.Name }}-pvc
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
storageClassName: standard
apiVersion: v1
kind: PersistentVolume
metadata:
name: {{ .Release.Name }}-pv
spec:
storageClassName: standard
capacity:
storage: 2Gi
persistentVolumeReclaimPolicy: Recycle
accessModes:
- ReadWriteOnce
nfs:
server: 192.168.100.109
path: "/mnt/nfs/grafana"
Currently, after grafana is restarted as pod level, almost of data or configuration will be removed. Then, need to be stored to other Node or NFS.