-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmonitoring.tf
More file actions
89 lines (81 loc) · 2.13 KB
/
monitoring.tf
File metadata and controls
89 lines (81 loc) · 2.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# Prometheus and Grafana for monitoring
resource "kubernetes_namespace_v1" "monitoring" {
metadata {
name = "monitoring"
}
}
# Prometheus using kube-prometheus-stack
resource "helm_release" "kube_prometheus_stack" {
name = "kube-prometheus-stack"
repository = "https://prometheus-community.github.io/helm-charts"
chart = "kube-prometheus-stack"
namespace = kubernetes_namespace_v1.monitoring.metadata[0].name
version = "65.0.0"
values = [
yamlencode({
prometheus = {
prometheusSpec = {
storageSpec = {
volumeClaimTemplate = {
spec = {
storageClassName = "ebs-sc"
accessModes = ["ReadWriteOnce"]
resources = {
requests = {
storage = "50Gi"
}
}
}
}
}
retention = "15d"
resources = {
requests = {
cpu = "500m"
memory = "2Gi"
}
limits = {
cpu = "2000m"
memory = "4Gi"
}
}
}
}
grafana = {
enabled = true
adminPassword = random_password.grafana_admin.result
persistence = {
enabled = true
storageClassName = "ebs-sc"
size = "10Gi"
}
service = {
type = "ClusterIP"
}
}
alertmanager = {
enabled = false
}
})
]
depends_on = [
kubernetes_storage_class_v1.ebs_csi_default,
module.eks
]
}
resource "random_password" "grafana_admin" {
length = 16
special = true
}
output "grafana_admin_password" {
value = random_password.grafana_admin.result
sensitive = true
}
output "grafana_access" {
value = "Access via port-forward: kubectl port-forward -n monitoring svc/kube-prometheus-stack-grafana 3000:80"
description = "Grafana access command (username: admin)"
}
output "grafana_service_name" {
value = "kube-prometheus-stack-grafana"
description = "Grafana service name in monitoring namespace"
}