{"id":13575168,"url":"https://github.com/StatCan/terraform-kubernetes-kube-prometheus-stack","last_synced_at":"2025-04-04T19:31:15.007Z","repository":{"id":50403109,"uuid":"359498416","full_name":"StatCan/terraform-kubernetes-kube-prometheus-stack","owner":"StatCan","description":"Terraform module for Kube-Prometheus Stack","archived":false,"fork":false,"pushed_at":"2024-12-13T15:18:05.000Z","size":181,"stargazers_count":11,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-27T05:42:14.741Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"HCL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/StatCan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-04-19T14:57:33.000Z","updated_at":"2024-12-13T15:16:12.000Z","dependencies_parsed_at":"2023-12-07T21:29:23.949Z","dependency_job_id":"2160cd20-7c7f-416c-887b-1760bb291191","html_url":"https://github.com/StatCan/terraform-kubernetes-kube-prometheus-stack","commit_stats":null,"previous_names":[],"tags_count":44,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StatCan%2Fterraform-kubernetes-kube-prometheus-stack","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StatCan%2Fterraform-kubernetes-kube-prometheus-stack/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StatCan%2Fterraform-kubernetes-kube-prometheus-stack/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StatCan%2Fterraform-kubernetes-kube-prometheus-stack/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/StatCan","download_url":"https://codeload.github.com/StatCan/terraform-kubernetes-kube-prometheus-stack/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247237678,"owners_count":20906329,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T15:00:58.730Z","updated_at":"2025-04-04T19:31:09.993Z","avatar_url":"https://github.com/StatCan.png","language":"HCL","funding_links":[],"categories":["HCL"],"sub_categories":[],"readme":"# Terraform Kubernetes Kube-Prometheus Stack\n\n## Introduction\n\nThis module deploys and configures the Kube-Prometheus Stack inside a Kubernetes Cluster.\n\n\u003c!-- BEGIN_TF_DOCS --\u003e\n## Requirements\n\n| Name | Version |\n|------|---------|\n| \u003ca name=\"requirement_terraform\"\u003e\u003c/a\u003e [terraform](#requirement\\_terraform) | \u003e= 1.0 |\n| \u003ca name=\"requirement_helm\"\u003e\u003c/a\u003e [helm](#requirement\\_helm) | \u003e= 2.0.0 |\n\n## Providers\n\n| Name | Version |\n|------|---------|\n| \u003ca name=\"provider_helm\"\u003e\u003c/a\u003e [helm](#provider\\_helm) | \u003e= 2.0.0 |\n| \u003ca name=\"provider_kubernetes\"\u003e\u003c/a\u003e [kubernetes](#provider\\_kubernetes) | n/a |\n\n\n\n## Inputs\n\n| Name | Description | Type | Default | Required |\n|------|-------------|------|---------|:--------:|\n| \u003ca name=\"input_chart_version\"\u003e\u003c/a\u003e [chart\\_version](#input\\_chart\\_version) | Version of the Helm chart | `any` | n/a | yes |\n| \u003ca name=\"input_helm_namespace\"\u003e\u003c/a\u003e [helm\\_namespace](#input\\_helm\\_namespace) | The namespace Helm will install the chart under | `any` | n/a | yes |\n| \u003ca name=\"input_cluster_domain\"\u003e\u003c/a\u003e [cluster\\_domain](#input\\_cluster\\_domain) | Cluster domain for DestinationRules | `string` | `\"cluster.local\"` | no |\n| \u003ca name=\"input_destinationrules_labels\"\u003e\u003c/a\u003e [destinationrules\\_labels](#input\\_destinationrules\\_labels) | Labels applied to DestinationRules | `map(string)` | `{}` | no |\n| \u003ca name=\"input_destinationrules_mode\"\u003e\u003c/a\u003e [destinationrules\\_mode](#input\\_destinationrules\\_mode) | DestionationRule TLS mode | `string` | `\"DISABLE\"` | no |\n| \u003ca name=\"input_enable_destinationrules\"\u003e\u003c/a\u003e [enable\\_destinationrules](#input\\_enable\\_destinationrules) | Creates DestinationRules for Prometheus, Alertmanager, Grafana, and Node Exporters | `bool` | `false` | no |\n| \u003ca name=\"input_enable_prometheusrules\"\u003e\u003c/a\u003e [enable\\_prometheusrules](#input\\_enable\\_prometheusrules) | Adds PrometheusRules for alerts | `bool` | `true` | no |\n| \u003ca name=\"input_helm_release\"\u003e\u003c/a\u003e [helm\\_release](#input\\_helm\\_release) | The name of the Helm release | `string` | `\"kube-prometheus-stack\"` | no |\n| \u003ca name=\"input_helm_repository\"\u003e\u003c/a\u003e [helm\\_repository](#input\\_helm\\_repository) | The repository where the Helm chart is stored | `string` | `\"https://prometheus-community.github.io/helm-charts\"` | no |\n| \u003ca name=\"input_helm_repository_password\"\u003e\u003c/a\u003e [helm\\_repository\\_password](#input\\_helm\\_repository\\_password) | The password of the repository where the Helm chart is stored | `string` | `\"\"` | no |\n| \u003ca name=\"input_helm_repository_username\"\u003e\u003c/a\u003e [helm\\_repository\\_username](#input\\_helm\\_repository\\_username) | The username of the repository where the Helm chart is stored | `string` | `\"\"` | no |\n| \u003ca name=\"input_prometheus_pvc_name\"\u003e\u003c/a\u003e [prometheus\\_pvc\\_name](#input\\_prometheus\\_pvc\\_name) | Used for storage alert. Set if using non-default helm\\_release | `string` | `\"prometheus-kube-prometheus-stack-prometheus-db-prometheus-kube-prometheus-stack-prometheus-0\"` | no |\n| \u003ca name=\"input_values\"\u003e\u003c/a\u003e [values](#input\\_values) | Values to be passed to the Helm chart | `string` | `\"\"` | no |\n| \u003ca name=\"alertmanager_replicas\"\u003e\u003c/a\u003e [alertmanager_replicas](#alertmanager\\_replicas) | Number of replicas for Alertmanager | `number` | `1` | no |\n\n## Outputs\n\n| Name | Description |\n|------|-------------|\n| \u003ca name=\"output_helm_namespace\"\u003e\u003c/a\u003e [helm\\_namespace](#output\\_helm\\_namespace) | n/a |\n| \u003ca name=\"output_helm_release\"\u003e\u003c/a\u003e [helm\\_release](#output\\_helm\\_release) | The name of the Helm release. For use by external ServiceMonitors |\n| \u003ca name=\"output_status\"\u003e\u003c/a\u003e [status](#output\\_status) | n/a |\n\u003c!-- END_TF_DOCS --\u003e\n\n## Usage\n\n```terraform\nmodule \"helm_kube_prometheus_stack\" {\n  source = \"git::https://github.com/canada-ca-terraform-modules/terraform-kubernetes-kube-prometheus-stack?ref=v3.3.0\"\n\n  chart_version = \"43.3.0\"\n  depends_on = [\n    module.namespace_monitoring,\n  ]\n\n  helm_namespace  = module.namespace_monitoring.name\n  helm_release    = \"kube-prometheus-stack\"\n  helm_repository = \"https://prometheus-community.github.io/helm-charts\"\n\n  enable_destinationrules = true\n\n  values = \u003c\u003cEOF\n\nEOF\n}\n```\n\n### Notes\n\n To upgrade an existing Helm release created from the [previous module](#previous-module) instead of reinstalling into a new Helm release, set `helm_release` to `\"prometheus-operator\"`. This will persist Helm release history and some temporary data, but may result in resource name and label aberrations.\n\n It is alternatively possible to reinstall into a new release while persisting existing data in Persistent Volumes from the previous module. This process involves downtime and does not guarantee data compatibility. A guide is available [here](#https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-prometheus-stack#redeploy-with-new-name-downtime). Note that there are further steps if multiple components (e.g. both Prometheus and Grafana) were configured with Persistent Volume storage. Their Persistent Volumes will need to be given different labels, and the components' `volumeClaimTemplate`s (defined in Helm values) will need to be given corresponding [selectors](https://docs.openshift.com/container-platform/3.3/install_config/persistent_storage/selector_label_binding.html#selector-label-volume-define).\n\n## History\n\n| Date       | Release | Change |\n| ---------- | ------- | ------ |\n| 2021-03-26 | v1.0.0  | 1st release |\n| 2021-07-05 | v1.1.0  | 1st set of general project alerts |\n| 2021-09-07 | v1.1.1  | `CompletedJobsNotCleared` scope set to `project` |\n| 2022-03-16 | v2.0.0  | Convert DestinationRules and PrometheusRules to `kubernetes_manifest`s. Updates for Terraform v1 and nomenclature |\n| 2022-07-28 | v2.0.1  | PrometheusRule severity label updates |\n| 2022-08-10 | v2.0.2  | Refactor the threshold for the VeleroHourlyBackupPartialFailure \u0026 VeleroHourlyBackupFailure alert |\n| 2022-08-10 | v2.0.3  | Create the NodeDiskMayFillIn60Hours alert |\n| 2022-08-10 | v2.0.4  | Delete the ManyAlertsFiring \u0026 ManyManyAlertsFiring alerts |\n| 2022-08-19 | v2.0.5  | Create the VeleroBackupTakingLongTime alert |\n| 2022-08-22 | v2.0.6  | Fix the VeleroBackupTakingLongTime alert severity level |\n| 2022-08-31 | v2.0.7  | Update nodepool pod capacity alerts and remove unused recording rule |\n| 2022-09-02 | v2.0.8  | Update threshold for when to expect a backup for the VeleroBackupTakingLongTime alert |\n| 2022-11-04 | v2.1.0  | Add several alerts and associated test cases regarding cert manager certificates |\n| 2022-11-08 | v2.1.1  | Adjust ContainerWaiting alert duration to align with PodNotReady |\n| 2022-11-16 | v2.1.2  | Fix node and nodepool pod capacity, NodePodsFull, and NodeReachingPodCapacity alerts |\n| 2022-11-24 | v2.2.0  | Add alert: PrometheusDiskMayFillIn60Hours |\n| 2022-12-06 | v2.3.0  | Add alert: NodeReadinessFlapping |\n| 2022-12-15 | v2.3.1  | Fix the NodeUnschedulable alert severity level |\n| 2023-01-04 | v3.0.0  | Refactor general cluster and namespace alerts. enable_prometheusrules false-\u003etrue. Removes variables: prometheusrules_labels, cluster_rules_name, namespace_rules_name, cert_manager_rules_name |\n| 2023-01-09 | v3.1.0  | Add runbook links to Prometheus rules |\n| 2023-01-11 | v3.1.1  | Fix ManyContainerRestarts alert to account for multiple metrics sources |\n| 2023-02-01 | v3.2.0  | Node clock alerts and README update |\n| 2023-02-03 | v3.2.1  | Specify sensitive variables |\n| 2023-02-08 | v3.3.0  | Add abilitity to add DestinationRule for Alertmanager replicas |\n| 2023-02-16 | v3.4.0  | Add rules for CoreDNS alerts |\n| 2023-03-10 | v3.4.1  | Fix syntax error in CoreDNS alert rules |\n| 2023-03-14 | v3.5.0  | Add rule for ContainerImagePullProblem, refactor container alert unit tests |\n| 2023-03-15 | v3.6.0  | Add DestinationRule for Thanos Sidecar |\n| 2023-03-28 | v3.7.0  | Add generic PVC alerts |\n| 2023-04-05 | v3.8.0  | Add \"cluster\" in prometheus rule aggregations to make compatible with Thanos. Add Prometheus heartbeat recording rule |\n| 2023-04-19 | v3.8.1  | Fix CoreDNSDown alert |\n| 2023-04-21 | v3.8.2  | Ensure prometheus heartbeat recording rule is evaluated by Prometheus |\n| 2023-05-04 | v3.8.3  | Fix ContainerImagePullProblem flapping |\n| 2023-06-08 | v3.9.0  | Ignore terminated pods in pod capacity alerts |\n| 2023-06-19 | v3.9.1  | Fix PersistentVolume status alerts |\n| 2023-12-07 | v3.9.2  | Adjust node alerts for clock synchronization |\n| 2024-02-29 | v3.9.3  | Adjust Node and PVC storage alerts |\n| 2024-04-15 | v3.9.4  | Adjust Node alerts, report agentpool, standardize node label |\n| 2024-05-31 | v3.9.5  | Update container alerts |\n\n## Upgrading\n\n### From v1.x to v2.x\n1. Note that in [Usage](#usage) the `dependencies` array has been replaced by the `depends_on` array.\n\n2. If **`enable_destinationrules`** was `true` in **v1.x**, locate the DestinationRules that were created in `helm_namespace`. There should be 4 correspoding to Prometheus, Alertmanager, Grafana, and the Prometheus Node Exporter. Delete them prior to the upgrade. If `enable_destinationrules` remains true, they will be recreated with minimal downtime.\n\n3. If **`enable_prometheusrules`** was `true` in **v1.x**, locate the PrometheusRule definitions that were created in `helm_namespace`. There should be 2: `general-platform-alerts` and `general-project-alerts`. Delete them prior to the upgrade. If `enable_prometheusrules` remains true, they will be recreated. This may resolve any presently firing alerts. If it does, they will fire again once their conditions are met.\n\n    - The default names for these PrometheusRule resources are now `general-cluster-alerts` and `general-namespace-alerts`. The scopes have changed from `platform` to `cluster` and from `project` to `namespace`. Adjust Alertmanager routing criteria accordingly.\n    - The severities for these rules have been adjusted from `minor/major/urgent` to `debug/minor/major`. Adjust Alertmanager routing criteria accordingly.\n\n\n\n## Previous Module\n\nThis module replaces [terraform-kubernetes-prometheus](https://github.com/StatCan/terraform-kubernetes-prometheus). The previous module used the custom chart [prometheus-operator](https://github.com/StatCan/charts/tree/master/stable/prometheus-operator), which used the now-deprecated upstream chart [prometheus-operator](https://github.com/helm/charts/tree/master/stable/prometheus-operator) as a sub-chart and added DestinationRules.\n\nThis new module uses the new upstream chart [kube-prometheus-stack](https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-prometheus-stack) directly. DestinationRules, as well as a set of general alerts, can be added through the module.\n\nTo migrate from the old custom chart to the new upstream chart, the following changes should be made to Helm values:\n\n1. Remove the top-level `prometheus-operator:` and realign indentation, as you are no longer applying values to a subchart.\n2. Remove any ` destinationRule:` specification and its contents, as this is now handled by [terraform variables](#variables-values).\n\nThe upstream `prometheus-operator` chart was renamed to `kube-prometheus-stack` to reflect that additional components beyond the Prometheus Operator are installed.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FStatCan%2Fterraform-kubernetes-kube-prometheus-stack","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FStatCan%2Fterraform-kubernetes-kube-prometheus-stack","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FStatCan%2Fterraform-kubernetes-kube-prometheus-stack/lists"}