--- apiVersion: v1 kind: PersistentVolumeClaim metadata: name: grafana-pvc labels: run: grafana app: demo-logging spec: accessModes: - ReadWriteOnce resources: requests: storage: 1Gi --- apiVersion: v1 kind: ConfigMap metadata: name: grafana-datasources labels: run: grafana app: demo-logging data: sources.yaml: |- { "apiVersion": 1, "datasources": [ { "access":"proxy", "editable": true, "name": "sf-metrics", "orgId": 1, "type": "prometheus", "url": "http://prometheus:9090", "version": 1 }, { "access":"proxy", "editable": true, "name": "loki-log-aggregator", "orgId": 1, "type": "loki", "url": "http://loki-http:3100", "version": 1 } ] } --- apiVersion: apps/v1 kind: Deployment metadata: labels: run: grafana app: demo-logging name: grafana spec: selector: matchLabels: run: grafana app: demo-logging template: metadata: labels: run: grafana app: demo-logging spec: securityContext: fsGroup: 472 supplementalGroups: - 0 containers: - name: grafana image: grafana/grafana:latest imagePullPolicy: IfNotPresent securityContext: allowPrivilegeEscalation: false capabilities: drop: ["ALL"] runAsNonRoot: true seccompProfile: type: RuntimeDefault ports: - containerPort: 3000 name: http-grafana protocol: TCP readinessProbe: failureThreshold: 3 httpGet: path: /robots.txt port: 3000 scheme: HTTP initialDelaySeconds: 10 periodSeconds: 30 successThreshold: 1 timeoutSeconds: 2 livenessProbe: failureThreshold: 3 initialDelaySeconds: 30 periodSeconds: 10 successThreshold: 1 tcpSocket: port: 3000 timeoutSeconds: 1 resources: requests: cpu: 250m memory: 750Mi volumeMounts: - mountPath: /var/lib/grafana name: grafana-pv - mountPath: /etc/grafana/provisioning/datasources name: grafana-datasources volumes: - name: grafana-pv persistentVolumeClaim: claimName: grafana-pvc - name: grafana-datasources configMap: defaultMode: 420 name: grafana-datasources --- apiVersion: v1 kind: Service metadata: name: grafana labels: run: grafana app: demo-logging spec: ports: - port: 3000 protocol: TCP targetPort: http-grafana selector: run: grafana app: demo-logging sessionAffinity: None --- apiVersion: route.openshift.io/v1 kind: Route metadata: name: grafana labels: run: grafana app: demo-logging spec: host: grafana.sfop.me path: / port: targetPort: 3000 tls: insecureEdgeTerminationPolicy: Redirect termination: edge to: kind: Service name: grafana weight: 100 wildcardPolicy: None