apiVersion: apps/v1 kind: Deployment metadata: name: grafana labels: app: grafana spec: selector: matchLabels: app: grafana template: metadata: labels: app: grafana spec: containers: - name: grafana image: grafana/grafana env: - name: GF_AUTH_ANONYMOUS_ENABLED value: "true" - name: GF_AUTH_ANONYMOUS_ORG_ROLE value: Admin - name: GF_DATABASE_TYPE value: mysql - name: GF_DATABASE_HOST value: mariadb.grafana.svc:3306 - name: GF_DATABASE_NAME valueFrom: secretKeyRef: name: mariadb-credentials-secret key: database - name: GF_DATABASE_USER valueFrom: secretKeyRef: name: mariadb-credentials-secret key: username - name: GF_DATABASE_PASSWORD valueFrom: secretKeyRef: name: mariadb-credentials-secret key: password ports: - name: http containerPort: 3000 volumeMounts: - name: grafana-datasources mountPath: /etc/grafana/provisioning/datasources volumes: - name: grafana-datasources configMap: name: grafana-datasources --- apiVersion: v1 kind: Service metadata: name: grafana labels: app: grafana monitor: main spec: selector: app: grafana ports: - name: http protocol: TCP port: 3000 targetPort: http --- apiVersion: networking.k8s.io/v1beta1 kind: Ingress metadata: name: grafana labels: app: grafana annotations: nginx.ingress.kubernetes.io/rewrite-target: / cert-manager.io/cluster-issuer: letsencrypt spec: tls: - hosts: - grafana.127.0.0.1.nip.io secretName: letsencrypt-cert rules: - host: grafana.127.0.0.1.nip.io http: paths: - path: / backend: serviceName: grafana servicePort: http