apiVersion: apps/v1
kind: Deployment
metadata:
name: grafana
namespace: monitoring
spec:
replicas: 1
selector:
matchLabels:
app: grafana
template:
metadata:
name: grafana
labels:
app: grafana
spec:
containers:
- name: grafana
image: grafana/grafana:latest
ports:
- name: grafana
containerPort: 3000
env:
- name: GF_SERVER_ROOT_URL
value: "https://grafana.exmaple.com/grafana"
- name: GF_SERVER_SERVE_FROM_SUB_PATH
value: "true"
resources:
limits:
memory: "1Gi"
cpu: "1000m"
requests:
memory: 500M
cpu: "500m"
volumeMounts:
- mountPath: /var/lib/grafana
name: grafana-storage
- mountPath: /etc/grafana/provisioning/datasources
name: grafana-datasources
readOnly: false
volumes:
- name: grafana-storage
emptyDir: {}
- name: grafana-datasources
configMap:
defaultMode: 420
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: grafana-ui
namespace: monitoring
annotations:
kubernetes.io/ingress.class: nginx
spec:
rules:
# Use the host you used in your kubernetes Ingress Configurations
- host: grafana.exmaple.com
http:
paths:
- backend:
service:
name: grafana
port:
number: 3000
path: /grafana
pathType: ImplementationSpecific
#pathType: Prefix
tls:
- hosts:
- grafana.exmaple.com
secretName: prometheus-secret