diff --git a/deploy/all.sh b/deploy/all.sh index 85e27a64038d3333ddeb48e1683c6fe874ce4971..cd33ff51600183ec4d282f2a48f82cb968a6e58a 100755 --- a/deploy/all.sh +++ b/deploy/all.sh @@ -213,6 +213,23 @@ export QDB_DROP_TABLES_IF_EXIST=${QDB_DROP_TABLES_IF_EXIST:-""} export QDB_REDEPLOY=${QDB_REDEPLOY:-""} +# ----- Time Series Storage - Prometheus / Grafana Mimir ----------------------- + +# If not already set, set Time Series Storage installation mode. Accepted values are: +# 'single' and 'cluster'. +# - If TSDB_DEPLOY_MODE is "single", Time Series Storage is deployed in single node +# mode and features a basic Prometheus instance. It is convenient for development and +# testing purposes and should fit in a VM. +# IT SHOULD NOT BE USED IN PRODUCTION ENVIRONMENTS. +# - If TSDB_DEPLOY_MODE is "cluster", Time Series Storage is deployed in cluster mode +# and a Grafana Mimir database in cluster mode will be deployed. It is convenient for +# production and provides scalability features. If you are deploying for production, +# also read the following link providing details on deploying Grafana Mimir for +# production environments: +# Ref: https://grafana.com/docs/mimir/latest/manage/run-production-environment/ +export TSDB_DEPLOY_MODE=${TSDB_DEPLOY_MODE:-"single"} + + # ----- K8s Observability ------------------------------------------------------ # If not already set, set the external port Prometheus Mgmt HTTP GUI interface will be exposed to. diff --git a/deploy/monitoring.sh b/deploy/monitoring.sh index c83d331e8c031c5b76ddc6794ab5ef6b022abc88..a577c432fc2daf82cc834a748e7dbdf78b053810 100755 --- a/deploy/monitoring.sh +++ b/deploy/monitoring.sh @@ -15,6 +15,24 @@ set -euo pipefail + +# ----- Time Series Storage - Prometheus / Grafana Mimir ----------------------- + +# If not already set, set Time Series Storage installation mode. Accepted values are: +# 'single' and 'cluster'. +# - If TSDB_DEPLOY_MODE is "single", Time Series Storage is deployed in single node +# mode and features a basic Prometheus instance. It is convenient for development and +# testing purposes and should fit in a VM. +# IT SHOULD NOT BE USED IN PRODUCTION ENVIRONMENTS. +# - If TSDB_DEPLOY_MODE is "cluster", Time Series Storage is deployed in cluster mode +# and a Grafana Mimir database in cluster mode will be deployed. It is convenient for +# production and provides scalability features. If you are deploying for production, +# also read the following link providing details on deploying Grafana Mimir for +# production environments: +# Ref: https://grafana.com/docs/mimir/latest/manage/run-production-environment/ +export TSDB_DEPLOY_MODE=${TSDB_DEPLOY_MODE:-"single"} + + # ----------------------------------------------------------- # Global namespace for all deployments # ----------------------------------------------------------- @@ -33,11 +51,11 @@ VALUES_FILE_PROM="$VALUES_FILE_PATH/prometheus_values.yaml" # ----------------------------------------------------------- # Mimir Configuration # ----------------------------------------------------------- -# RELEASE_NAME_MIMIR="mon-mimir" -# CHART_REPO_NAME_MIMIR="grafana" -# CHART_REPO_URL_MIMIR="https://grafana.github.io/helm-charts" -# CHART_NAME_MIMIR="mimir-distributed" -# VALUES_FILE_MIMIR="$VALUES_FILE_PATH/mimir_values.yaml" +RELEASE_NAME_MIMIR="mon-mimir" +CHART_REPO_NAME_MIMIR="grafana" +CHART_REPO_URL_MIMIR="https://grafana.github.io/helm-charts" +CHART_NAME_MIMIR="mimir-distributed" +VALUES_FILE_MIMIR="$VALUES_FILE_PATH/mimir_values.yaml" # ----------------------------------------------------------- # Grafana Configuration @@ -105,16 +123,19 @@ kubectl rollout status deployment/"$RELEASE_NAME_PROM-server" -n "$NAMESPACE" || # 2) Deploy Mimir -# deploy_chart "$RELEASE_NAME_MIMIR" \ -# "$CHART_REPO_NAME_MIMIR" \ -# "$CHART_REPO_URL_MIMIR" \ -# "$CHART_NAME_MIMIR" \ -# "$VALUES_FILE_MIMIR" \ -# "$NAMESPACE" - -# Depending on how Mimir runs (StatefulSets, Deployments), you can wait for -# the correct resource to be ready. For example: -# kubectl rollout status statefulset/"$RELEASE_NAME_MIMIR-distributor" -n "$NAMESPACE" || true +if [ "$TSDB_DEPLOY_MODE" == "cluster" ]; then + echo "Deploying Mimir in production mode." + # You can add any production-specific configurations here if needed + deploy_chart "$RELEASE_NAME_MIMIR" \ + "$CHART_REPO_NAME_MIMIR" \ + "$CHART_REPO_URL_MIMIR" \ + "$CHART_NAME_MIMIR" \ + "$VALUES_FILE_MIMIR" \ + "$NAMESPACE" + + # you can wait for the resource to be ready. + kubectl rollout status statefulset/"$RELEASE_NAME_MIMIR-distributor" -n "$NAMESPACE" || true +fi # 3) Deploy Grafana diff --git a/manifests/monitoring/grafana_values.yaml b/manifests/monitoring/grafana_values.yaml index 0757603063e9c04873c14e2f70ea2c69d2fbe3ff..630fd7ef9f44d4d113dd3b0a9b1a71adf30d5d82 100644 --- a/manifests/monitoring/grafana_values.yaml +++ b/manifests/monitoring/grafana_values.yaml @@ -210,7 +210,7 @@ datasources: isDefault: true - name: Mimir type: prometheus - url: http://mimir-nginx.mon-mimir.svc:80/prometheus + url: http://mon-mimir-gateway.monitoring.svc.cluster.local/prometheus access: proxy isDefault: false diff --git a/manifests/monitoring/mimir_values.yaml b/manifests/monitoring/mimir_values.yaml new file mode 100644 index 0000000000000000000000000000000000000000..c7fa5bf94b496ed56d65e27286123c96645df460 --- /dev/null +++ b/manifests/monitoring/mimir_values.yaml @@ -0,0 +1,132 @@ +# Copyright 2022-2025 ETSI SDG TeraFlowSDN (TFS) (https://tfs.etsi.org/) +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Minimal Mimir for lab/PoC using single-binary and in-cluster MinIO. +# Chart: grafana/mimir-distributed + +global: + # -- Definitions to set up nginx resolver + dnsService: kube-dns + dnsNamespace: kube-system + clusterDomain: cluster.local. + dnsConfig: {} + +# Mimir structured configuration. Wires storage to the in-cluster MinIO. +mimir: + structuredConfig: + common: + storage: + backend: s3 + s3: + endpoint: minio:9000 + access_key_id: grafana-mimir + secret_access_key: supersecret # change in real clusters + insecure: true + blocks_storage: + s3: + bucket_name: mimir-tsdb + ruler_storage: + s3: + bucket_name: mimir-ruler + alertmanager_storage: + s3: + bucket_name: mimir-alertmanager + +minio: + enabled: true + mode: standalone + rootUser: grafana-mimir + rootPassword: supersecret # change in real clusters + buckets: + - name: mimir-tsdb + policy: none + purge: false + - name: mimir-ruler + policy: none + purge: false + - name: mimir-alertmanager + policy: none + purge: false + persistence: + enabled: true + size: 10Gi + resources: + requests: + cpu: 100m + memory: 128Mi + +# Disable embedded Kafka. Not needed for this minimal setup. +kafka: + enabled: false + +# Keep the NGINX gateway internal to the cluster for simplicity. +gateway: + enabled: true + replicas: 1 + service: + type: ClusterIP + port: 80 + nginx: + verboseLogging: true + resources: + requests: + cpu: 100m + memory: 128Mi + limits: + cpu: 500m + memory: 512Mi + +# Turn off sharded components. singleBinary runs the core services already. +distributor: + replicas: 0 +ingester: + replicas: 0 +querier: + replicas: 0 +query_frontend: + replicas: 0 +query_scheduler: + replicas: 0 +store_gateway: + replicas: 0 +compactor: + replicas: 0 + +# Optional features disabled for minimum footprint. +ruler: + enabled: false +alertmanager: + enabled: false +overrides_exporter: + enabled: false + +# Caches off for minimal footprint. Enable later if you need performance. +memcached: + enabled: false +memcached-queries: + enabled: false +memcached-metadata: + enabled: false +memcached-results: + enabled: false + +# Meta-monitoring off to keep footprint small. Turn on when you add Prometheus. +metaMonitoring: + dashboards: + enabled: false + serviceMonitor: + enabled: false + prometheusRule: + enabled: false + grafanaAgent: + enabled: false diff --git a/my_deploy.sh b/my_deploy.sh index b8ed95a826dcb0a1f4c90f4bbfa067540e98e174..24e1f6902adca8233f22521f69cc66029e59b486 100644 --- a/my_deploy.sh +++ b/my_deploy.sh @@ -217,6 +217,14 @@ export QDB_DROP_TABLES_IF_EXIST="" export QDB_REDEPLOY="" +# ----- Time Series Storage - Prometheus / Grafana Mimir ----------------------- + +# Set Time Series Storage installation mode to 'single' (i.e., Prometheus only). +# This option is convenient for development and testing. See ./deploy/all.sh or +# ./deploy/monitoring.sh for additional details. +export TSDB_DEPLOY_MODE="single" + + # ----- K8s Observability ------------------------------------------------------ # Set the external port Prometheus Mgmt HTTP GUI interface will be exposed to.