Skip to content

Commit 58a29fb

Browse files
authored
Merge pull request #278369 from fossygirl/deploy-postgres-ha
Deploy a Highly Available PostgreSQL Database on AKS using the Azure CLI
2 parents 6bc6e57 + d10bea9 commit 58a29fb

File tree

10 files changed

+1646
-2
lines changed

10 files changed

+1646
-2
lines changed

articles/aks/TOC.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,17 @@
337337
- name: Use the Azure portal
338338
href: virtual-nodes-portal.md
339339
- name: Workloads
340-
items:
340+
items:
341+
- name: Stateful workloads
342+
items:
343+
- name: Deploy a highly available PostgreSQL database
344+
items:
345+
- name: Overview
346+
href: postgresql-ha-overview.md
347+
- name: Create infrastructure resources
348+
href: create-postgresql-ha.md
349+
- name: Deploy and test PostgreSQL
350+
href: deploy-postgresql-ha.md
341351
- name: GPU workloads
342352
items:
343353
- name: Use GPUs
@@ -973,4 +983,4 @@
973983
- name: Support options for AKS
974984
href: aks-support-help.md
975985
- name: Troubleshooting documentation for AKS
976-
href: /troubleshoot/azure/azure-kubernetes/welcome-azure-kubernetes
986+
href: /troubleshoot/azure/azure-kubernetes/welcome-azure-kubernetes

articles/aks/create-postgresql-ha.md

Lines changed: 551 additions & 0 deletions
Large diffs are not rendered by default.

articles/aks/deploy-postgresql-ha.md

Lines changed: 994 additions & 0 deletions
Large diffs are not rendered by default.
105 KB
Loading
105 KB
Loading
153 KB
Loading
119 KB
Loading
128 KB
Loading
60.1 KB
Loading
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
---
2+
title: 'Overview of deploying a highly available PostgreSQL database on AKS with Azure CLI'
3+
description: Learn how to deploy a highly available PostgreSQL database on AKS using the CloudNativePG operator.
4+
ms.topic: overview
5+
ms.date: 06/07/2024
6+
author: kenkilty
7+
ms.author: kkilty
8+
ms.custom: innovation-engine, aks-related-content
9+
#Customer intent: As a developer or cluster operator, I want to deploy a highly available PostgreSQL database on AKS so I can see how to run a stateful database workload using the managed Kubernetes service in Azure.
10+
---
11+
# Deploy a highly available PostgreSQL database on AKS with Azure CLI
12+
13+
In this guide, you deploy a highly available PostgreSQL cluster that spans multiple Azure availability zones on AKS with Azure CLI.
14+
15+
This article walks through the prerequisites for setting up a PostgreSQL cluster on [Azure Kubernetes Service (AKS)][what-is-aks] and provides an overview of the full deployment process and architecture.
16+
17+
## Prerequisites
18+
19+
* This guide assumes a basic understanding of [core Kubernetes concepts][core-kubernetes-concepts] and [PostgreSQL][postgresql].
20+
* You need the **Owner** or **User Access Administrator** and the **Contributor** [Azure built-in roles][azure-roles] on a subscription in your Azure account.
21+
22+
[!INCLUDE [azure-cli-prepare-your-environment-no-header.md](~/reusable-content/azure-cli/azure-cli-prepare-your-environment-no-header.md)]
23+
24+
* You also need the following resources installed:
25+
26+
* [Azure CLI](/cli/azure/install-azure-cli) version 2.56 or later.
27+
* [Azure Kubernetes Service (AKS) preview extension][aks-preview].
28+
* [jq][jq], version 1.5 or later.
29+
* [kubectl][install-kubectl] version 1.21.0 or later.
30+
* [Helm][install-helm] version 3.0.0 or later.
31+
* [openssl][install-openssl] version 3.3.0 or later.
32+
* [Visual Studio Code][install-vscode] or equivalent.
33+
* [Krew][install-krew] version 0.4.4 or later.
34+
* [kubectl CloudNativePG (CNPG) Plugin][cnpg-plugin].
35+
36+
## Deployment process
37+
38+
In this guide, you learn how to:
39+
40+
* Use Azure CLI to create a multi-zone AKS cluster.
41+
* Deploy a highly available PostgreSQL cluster and database using the [CNPG operator][cnpg-plugin].
42+
* Set up monitoring for PostgreSQL using Prometheus and Grafana.
43+
* Deploy a sample dataset to a PostgreSQL database.
44+
* Perform PostgreSQL and AKS cluster upgrades.
45+
* Simulate a cluster interruption and PostgreSQL replica failover.
46+
* Perform backup and restore of a PostgreSQL database.
47+
48+
## Deployment architecture
49+
50+
This diagram illustrates a PostgreSQL cluster setup with one primary replica and two read replicas managed by the [CloudNativePG (CNPG)](https://cloudnative-pg.io/) operator. The architecture provides a highly available PostgreSQL running on an AKS cluster that can withstand a zone outage by failing over across replicas.
51+
52+
Backups are stored on [Azure Blob Storage](/azure/storage/blobs/), providing another way to restore the database in the event of an issue with streaming replication from the primary replica.
53+
54+
:::image source="./media/postgresql-ha-overview/architecture-diagram.png" alt-text="Diagram of CNPG architecture." lightbox="./media/postgresql-ha-overview/architecture-diagram.png":::
55+
56+
> [!NOTE]
57+
> The CNPG operator supports only *one database per cluster*. Plan accordingly for applications that require data separation at the database level.
58+
59+
## Next steps
60+
61+
> [!div class="nextstepaction"]
62+
> [Create the infrastructure to deploy a highly available PostgreSQL database on AKS using the CNPG operator][create-infrastructure]
63+
64+
## Contributors
65+
66+
*This article is maintained by Microsoft. It was originally written by the following contributors*:
67+
68+
* Ken Kilty | Principal TPM
69+
* Russell de Pina | Principal TPM
70+
* Adrian Joian | Senior Customer Engineer
71+
* Jenny Hayes | Senior Content Developer
72+
* Carol Smith | Senior Content Developer
73+
* Erin Schaffer | Content Developer 2
74+
* Adam Sharif | Customer Engineer 2
75+
76+
<!-- LINKS -->
77+
[what-is-aks]: ./what-is-aks.md
78+
[postgresql]: https://www.postgresql.org/
79+
[core-kubernetes-concepts]: ./concepts-clusters-workloads.md
80+
[azure-roles]: ../role-based-access-control/built-in-roles.md
81+
[aks-preview]: ./draft.md#install-the-aks-preview-azure-cli-extension
82+
[jq]: https://jqlang.github.io/jq/
83+
[install-kubectl]: https://kubernetes.io/docs/tasks/tools/install-kubectl/
84+
[install-helm]: https://helm.sh/docs/intro/install/
85+
[install-openssl]: https://www.openssl.org/
86+
[install-vscode]: https://code.visualstudio.com/Download
87+
[install-krew]: https://krew.sigs.k8s.io/
88+
[cnpg-plugin]: https://cloudnative-pg.io/documentation/current/kubectl-plugin/#using-krew
89+
[create-infrastructure]: ./create-postgresql-ha.md

0 commit comments

Comments
 (0)