The following project configures one cronjob application in Azure Kubernetes Server to take full backups of a database on one Azure Database for PostgreSQL Flexible Server.
- Terraform
- Azure CLI
- Kubectl
- Helm Chart
- Helmfile
Assign the RBAC roles "Contributor", "User Access Administrator" to the User account on the Subscription level.
Create a file terraform.tfvars and specify the values for the following Terraform variables:
subscription_id="<subscription_id>"
location="<azure_region>" # e.g. "westeurope"
location_abbreviation="<azure_region_abbreviation>" # e.g. "weu"
environment="<environment_name>" # e.g. "test"
workload_name="<workload_name>"
postgresql_administrator_login="<postgresql_administrator_name>"
postgresql_administrator_password="<postgresql_administrator_password>"
allowed_public_ip_address_ranges=[<list_of_allowed_ip_address_ranges>] # Public IP Address ranges allowed to access the Azure resources e.g. "1.2.3.4/32"
allowed_public_ip_addresses=<[<list_of_allowed_ip_addresses>] # Public IP Addresses allowed to access the Azure resources e.g. "1.2.3.4"Before proceeding with the next sections, open a terminal and login in Azure with Azure CLI using the User account.
terraform init -reconfigureterraform planterraform apply -auto-approvefind . -not -path "*/.terraform/*" -type f -name '*.tf' -print | uniq | xargs -n1 terraform fmtcd helm
helmfile applykubectl get serviceaccount -n application
kubectl get secret -n application
kubectl get cronjob -n applicationcd helm
helmfile deletekubectl get jobs -n application
kubectl get pods --selector=job-name=<job-name> -n application
kubectl logs -f <pod-name> -n application