SquareOps Technologies Your DevOps Partner for Accelerating cloud journey.
This module allows you to easily deploy a Postgresql database in HA on Kubernetes using Helm. It provides flexible configuration options for the Postgresql database, including storage class. Deploying Postgresql database exporters to gather metrics for Grafana. This module is designed to be highly configurable and customizable, and can be easily integrated into your existing Terraform infrastructure code.
Postgrsql Helm Chart Version | K8s supported version (EKS, AKS & GKE) |
---|---|
14.2.11 | 1.23,1.24,1.25,1.26,1.27,1.28,1.29 |
locals {
name = "postgresql"
region = "us-east-2"
environment = "prod"
additional_tags = {
Owner = "organization_name"
Expires = "Never"
Department = "Engineering"
}
store_password_to_secret_manager = true
custom_credentials_enabled = true
custom_credentials_config = {
postgres_password = "60rbJs901a6Oa9hzUM5x7s8Q"
repmgr_password = "IWHLlEYOt25jL4Io7pancB"
}
}
module "aws" {
source = "[email protected]:sq-ia/terraform-kubernetes-postgresql.git//modules/resourcces/aws"
name = local.name
environment = local.environment
cluster_name = "cluster-name"
store_password_to_secret_manager = local.store_password_to_secret_manager
custom_credentials_enabled = local.custom_credentials_enabled
custom_credentials_config = local.custom_credentials_config
}
module "postgresql" {
source = "[email protected]:sq-ia/terraform-kubernetes-postgresql.git"
postgresql_exporter_enabled = true
postgresql_config = {
name = local.name
environment = local.environment
replicaCount = 3
storage_class = "gp2"
postgresql_values = ""
store_password_to_secret_manager = local.store_password_to_secret_manager
custom_credentials_enabled = local.custom_credentials_enabled
custom_credentials_config = local.custom_credentials_config
postgres_password = local.custom_credentials_enabled ? "" : module.aws.postgresql_credential.postgres_password
repmgr_password = local.custom_credentials_enabled ? "" : module.aws.postgresql_credential.repmgr_password
}
}
- Refer AWS examples for more details.
- Refer Azure examples for more details.
- Refer GCP examples for more details.
- In order to enable the exporter, it is required to deploy Prometheus/Grafana first.
- The exporter is a tool that extracts metrics data from an application or system and makes it available to be scraped by Prometheus.
- Prometheus is a monitoring system that collects metrics data from various sources, including exporters, and stores it in a time-series database.
- Grafana is a data visualization and dashboard tool that works with Prometheus and other data sources to display the collected metrics in a user-friendly way.
- To deploy Prometheus/Grafana, please follow the installation instructions for each tool in their respective documentation.
- Once Prometheus and Grafana are deployed, the exporter can be configured to scrape metrics data from your application or system and send it to Prometheus.
- Finally, you can use Grafana to create custom dashboards and visualize the metrics data collected by Prometheus.
- This module is compatible with EKS, AKS & GKE which is great news for users deploying the module on an AWS, Azure & GCP cloud. Review the module's documentation, meet specific configuration requirements, and test thoroughly after deployment to ensure everything works as expected.
Name | Version |
---|---|
aws | >= 4.23 |
helm | >= 2.6 |
kubernetes | >= 2.13 |
Name | Version |
---|---|
helm | >= 2.6 |
kubernetes | >= 2.13 |
No modules.
Name | Type |
---|---|
helm_release.postgres_exporter | resource |
helm_release.postgresql_backup | resource |
helm_release.postgresql_ha | resource |
helm_release.postgresql_restore | resource |
kubernetes_namespace.postgresql | resource |
Name | Description | Type | Default | Required |
---|---|---|---|---|
chart_version | Version of the Postgresql helm chart that will be deployed. | string |
"14.2.11" |
no |
cluster_name | Name of eks cluster | string |
"" |
no |
create_namespace | Whether or not to deploy postgresql | bool |
true |
no |
custom_credentials_config | Specify the configuration settings for Postgresql to pass custom credentials during creation. | any |
{ |
no |
custom_credentials_enabled | Specifies whether to enable custom credentials for PostgreSQL database. | bool |
false |
no |
iam_role_arn_backup | IAM role ARN for backup (AWS) | string |
"" |
no |
iam_role_arn_restore | IAM role ARN for restore (AWS) | string |
"" |
no |
postgres_password | PostgresQL password | any |
"" |
no |
postgresql_backup_config | configuration options for Pgsql database backups. It includes properties such as the S3 bucket Name, the S3 bucket region, and the cron expression for full backups. | any |
{ |
no |
postgresql_backup_enabled | Specifies whether to enable backups for Pgsql database. | bool |
false |
no |
postgresql_config | Configuration options for the postgresql such as number of replica,chart version, storage class and store password at secret manager. | map(string) |
{ |
no |
postgresql_enabled | Whether or not to deploy postgresql | bool |
true |
no |
postgresql_exporter_enabled | Whether or not to deploy postgresql exporter | bool |
false |
no |
postgresql_namespace | Name of the Kubernetes namespace where the postgresql will be deployed. | string |
"postgresql" |
no |
postgresql_restore_config | Configuration options for restoring dump to the Postgresql database. | any |
{ |
no |
postgresql_restore_enabled | Specifies whether to enable restoring dump to the Postgresql database. | bool |
false |
no |
recovery_window_aws_secret | Number of days that AWS Secrets Manager will wait before deleting a secret. This value can be set to 0 to force immediate deletion, or to a value between 7 and 30 days to allow for recovery. | number |
0 |
no |
repmgr_password | Replication manager password | any |
"" |
no |
Name | Description |
---|---|
postgresql_credential | PostgreSQL credentials used for accessing the database. |
postgresql_endpoints | PostgreSQL endpoints in the Kubernetes cluster. |
To report an issue with a project:
- Check the repository's issue tracker on GitHub
- Search to see if the issue has already been reported
- If you can't find an answer to your question in the documentation or issue tracker, you can ask a question by creating a new issue. Be sure to provide enough context and details so others can understand your problem.
Apache License, Version 2.0, January 2004 (http://www.apache.org/licenses/).
To support a GitHub project by liking it, you can follow these steps:
-
Visit the repository: Navigate to the GitHub repository.
-
Click the "Star" button: On the repository page, you'll see a "Star" button in the upper right corner. Clicking on it will star the repository, indicating your support for the project.
-
Optionally, you can also leave a comment on the repository or open an issue to give feedback or suggest changes.
Starring a repository on GitHub is a simple way to show your support and appreciation for the project. It also helps to increase the visibility of the project and make it more discoverable to others.
We believe that the key to success in the digital age is the ability to deliver value quickly and reliably. That’s why we offer a comprehensive range of DevOps & Cloud services designed to help your organization optimize its systems & Processes for speed and agility.
- We are an AWS Advanced consulting partner which reflects our deep expertise in AWS Cloud and helping 100+ clients over the last 5 years.
- Expertise in Kubernetes and overall container solution helps companies expedite their journey by 10X.
- Infrastructure Automation is a key component to the success of our Clients and our Expertise helps deliver the same in the shortest time.
- DevSecOps as a service to implement security within the overall DevOps process and helping companies deploy securely and at speed.
- Platform engineering which supports scalable,Cost efficient infrastructure that supports rapid development, testing, and deployment.
- 24*7 SRE service to help you Monitor the state of your infrastructure and eradicate any issue within the SLA.
We provide support on all of our projects, no matter how small or large they may be.
To find more information about our company, visit squareops.com, follow us on Linkedin, or fill out a job application. If you have any questions or would like assistance with your cloud strategy and implementation, please don't hesitate to contact us.