Skip to content

Commit fbadca7

Browse files
authored
feat: Introduce possibility to install VictoriaMetrics or Prometheus (#222)
1 parent ee4c51d commit fbadca7

16 files changed

+728
-113
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,7 @@ This boiler installs all basic and necessary components. However, we also provid
446446
447447
Notes:
448448
* [Gitlab-runner](docs/FAQ.md#gitlab-runner)
449+
* [Monitoring](docs/FAQ.md#monitoring)
449450
450451
## TFSEC
451452

docs/FAQ.md

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,9 +218,17 @@ runners:
218218
...
219219
```
220220

221+
## Monitoring
222+
This boilerplate provides two solutions for monitoring:
223+
1. VictoriaMetrics based on [victoria-metrics-k8s-stack](https://github.com/VictoriaMetrics/helm-charts/tree/master/charts/victoria-metrics-k8s-stack)
224+
2. Prometheus based on [kube-prometheus-stack](https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-prometheus-stack)
225+
226+
VictoriaMetrics is installed by default. However, you can easily switch to Prometheus just **enabling** it and **disabling** VictoriaMetrics in `terraform/layer2-k8s/helm-releases.yaml`. You need to do it before the first apply of the layer2-k8s.
227+
VictoriaMetrics Operator supports several [Prometheus objects](https://github.com/VictoriaMetrics/operator#overview). For example, Servicemonitor, PrometheusRule. However, we need to somehow install necessary Prometheus CRDs in a k8s cluster. So, it's done in the `eks-prometheus-operator-crds.tf` file, where we install Prometheus' CRDs separately from kube-prometheus-stack.
228+
221229
## Grafana: How to add GitHub/Gitlab OAuth2 Authentication:
222230
By default we install Grafana without integrating it with GitHub or Gitlab and use basic authentication (login/password). If you want to integrate it to use OAuth2, then do next:
223-
1. Set `grafana_oauth_type` variable in the `terraform/layer2-k8s/eks-kube-prometheus-stack.tf` to the desired value (github or gitlab).
231+
1. Set `grafana_oauth_type` variable in the `terraform/layer2-k8s/eks-victoria-metrics-k8s-stack.tf` or `terraform/layer2-k8s/eks-kube-prometheus-stack.tf` to the desired value (github or gitlab).
224232
2. **Gitlab**:
225233
* See [this instruction](https://grafana.com/docs/grafana/latest/auth/gitlab/#gitlab-oauth2-authentication) and generate necessary tokens.
226234
* Set `grafana_gitlab_client_id`, `grafana_gitlab_client_secret`, `grafana_gitlab_group` variables in [AWS Secrets Manager](https://console.aws.amazon.com/secretsmanager/home?region=us-east-1#!/home) secret with the pattern `/${local.name_wo_region}/infra/layer2-k8s`.
@@ -230,7 +238,31 @@ By default we install Grafana without integrating it with GitHub or Gitlab and u
230238

231239
## Alertmanager
232240
Alertmanager is disabled in default installation. If you want to enable it, then do next:
233-
1. Open file layer2-k8s/eks-kube-prometheus-stack.tf and change :
241+
1. VictoriaMetrics:
242+
Open file layer2-k8s/eks-victoria-metrics-k8s-stack.tf and change :
243+
```yaml
244+
locals {
245+
....
246+
victoria_metrics_k8s_stack_alertmanager_values = <<VALUES
247+
# Alertmanager parameters
248+
alertmanager:
249+
enabled: false
250+
....
251+
}
252+
253+
to
254+
255+
locals {
256+
....
257+
victoria_metrics_k8s_stack_alertmanager_values = <<VALUES
258+
# Alertmanager parameters
259+
alertmanager:
260+
enabled: true
261+
....
262+
}
263+
```
264+
2. Prometheus:
265+
Open file layer2-k8s/eks-kube-prometheus-stack.tf and change :
234266
```yaml
235267
locals {
236268
....

terraform/layer2-k8s/.terraform.lock.hcl

Lines changed: 36 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)