Skip to content

Commit 8691d16

Browse files
authored
Merge pull request #6 from fossygirl/aj_fixes
Formatting fixes
2 parents a9354a4 + 59b2d6d commit 8691d16

File tree

2 files changed

+40
-32
lines changed

2 files changed

+40
-32
lines changed

articles/aks/create-postgresql-ha.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ To validate deployment of the PostgreSQL cluster and use client PostgreSQL tooli
410410
--output table
411411
```
412412
413-
1. Get the newly created public IP address using the [`az network public-ip show`][az-network-public-ip-show] command.
413+
3. Get the newly created public IP address using the [`az network public-ip show`][az-network-public-ip-show] command.
414414
415415
```azurecli-interactive
416416
export AKS_PRIMARY_CLUSTER_PUBLICIP_ADDRESS=$(az network public-ip show \
@@ -422,7 +422,7 @@ To validate deployment of the PostgreSQL cluster and use client PostgreSQL tooli
422422
echo $AKS_PRIMARY_CLUSTER_PUBLICIP_ADDRESS
423423
```
424424
425-
2. Get the resource ID of the node resource group using the [`az group show`][az-group-show] command.
425+
4. Get the resource ID of the node resource group using the [`az group show`][az-group-show] command.
426426
427427
```azurecli-interactive
428428
export AKS_PRIMARY_CLUSTER_NODERG_NAME_SCOPE=$(az group show --name \
@@ -433,7 +433,7 @@ To validate deployment of the PostgreSQL cluster and use client PostgreSQL tooli
433433
echo $AKS_PRIMARY_CLUSTER_NODERG_NAME_SCOPE
434434
```
435435
436-
3. Assign the "Network Contributor" role to the UAMI object ID using the node resource group scope using the [`az role assignment create`][az-role-assignment-create] command.
436+
5. Assign the "Network Contributor" role to the UAMI object ID using the node resource group scope using the [`az role assignment create`][az-role-assignment-create] command.
437437
438438
```azurecli-interactive
439439
az role assignment create \
@@ -491,6 +491,7 @@ In this section, you install the CNPG operator in the AKS cluster using Helm or
491491
--namespace $PG_SYSTEM_NAMESPACE cnpg-controller-manager \
492492
--context $AKS_PRIMARY_CLUSTER_NAME
493493
```
494+
494495
---
495496
496497
## Next steps

articles/aks/deploy-postgresql-ha.md

Lines changed: 36 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ In this article, you deploy a highly available PostgreSQL database on AKS.
1414

1515
* If you haven't already created the required infrastructure for this deployment, follow the steps in [Create infrastructure for deploying a highly available PostgreSQL database on AKS][create-infrastructure] to get set up, and then you can return to this article.
1616

17-
1817
## Create secret for bootstrap app user
1918

2019
1. Generate a secret to validate the PostgreSQL deployment by interactive login for a bootstrap app user using the [`kubectl create secret`][kubectl-create-secret] command.
@@ -141,39 +140,39 @@ The following table outlines the key properties set in the YAML deployment manif
141140
service.beta.kubernetes.io/azure-dns-label-name: $AKS_PRIMARY_CLUSTER_PG_DNSPREFIX
142141
labels:
143142
azure.workload.identity/use: "true"
144-
143+
145144
instances: 3
146145
minSyncReplicas: 1
147146
maxSyncReplicas: 1
148-
147+
149148
topologySpreadConstraints:
150149
- maxSkew: 1
151150
topologyKey: topology.kubernetes.io/zone
152151
whenUnsatisfiable: DoNotSchedule
153152
labelSelector:
154153
matchLabels:
155154
cnpg.io/cluster: $PG_PRIMARY_CLUSTER_NAME
156-
155+
157156
affinity:
158157
nodeSelector:
159158
workload: postgres
160-
159+
161160
resources:
162161
requests:
163162
memory: '2Gi'
164163
cpu: 1.5
165164
limits:
166165
memory: '2Gi'
167166
cpu: 1.5
168-
167+
169168
bootstrap:
170169
initdb:
171170
database: appdb
172171
owner: app
173172
secret:
174173
name: db-user-pass
175174
dataChecksums: true
176-
175+
177176
storage:
178177
size: 2Gi
179178
pvcTemplate:
@@ -183,7 +182,7 @@ The following table outlines the key properties set in the YAML deployment manif
183182
requests:
184183
storage: 2Gi
185184
storageClassName: managed-csi-premium
186-
185+
187186
walStorage:
188187
size: 2Gi
189188
pvcTemplate:
@@ -193,14 +192,14 @@ The following table outlines the key properties set in the YAML deployment manif
193192
requests:
194193
storage: 2Gi
195194
storageClassName: managed-csi-premium
196-
195+
197196
monitoring:
198197
enablePodMonitor: true
199-
198+
200199
replicationSlots:
201200
highAvailability:
202201
enabled: true
203-
202+
204203
postgresql:
205204
parameters:
206205
shared_buffers: "256MB"
@@ -215,13 +214,13 @@ The following table outlines the key properties set in the YAML deployment manif
215214
azure.workload.identity/client-id: "$AKS_UAMI_WORKLOAD_CLIENTID"
216215
labels:
217216
azure.workload.identity/use: "true"
218-
217+
219218
backup:
220219
barmanObjectStore:
221220
destinationPath: "https://${PG_PRIMARY_STORAGE_ACCOUNT_NAME}.blob.core.windows.net/backups"
222221
azureCredentials:
223222
inheritFromAzureAD: true
224-
223+
225224
retentionPolicy: '7d'
226225
EOF
227226
```
@@ -233,6 +232,7 @@ The following table outlines the key properties set in the YAML deployment manif
233232
```
234233
235234
Example output
235+
236236
```output
237237
NAME READY STATUS RESTARTS AGE
238238
pg-primary-cnpg-r8c7unrw-1 1/1 Running 0 4m25s
@@ -242,7 +242,7 @@ The following table outlines the key properties set in the YAML deployment manif
242242
243243
### Validate the Prometheus PodMonitor is running
244244
245-
The CNPG operator automatically creates a PodMonitor for the primary instance using the recording rules created during the [Prometheus Community installation](#install-the-cnpg-operator).
245+
The CNPG operator automatically creates a PodMonitor for the primary instance using the recording rules created during the [Prometheus Community installation](#install-the-cnpg-operator).
246246
247247
* Validate the PodMonitor is running using the [`kubectl get`][kubectl-get] command.
248248
@@ -255,6 +255,7 @@ The CNPG operator automatically creates a PodMonitor for the primary instance us
255255
```
256256
257257
Example output
258+
258259
```output
259260
kind: PodMonitor
260261
metadata:
@@ -301,14 +302,14 @@ Once you have deployed the Postgres cluster and the pod monitor, you can view th
301302
![Azure Monitor Metrics](./media/deploy-postgresql-ha/cnpg-prom-metrics.png)
302303

303304
#### Option B - Managed Grafana
305+
304306
Alternatively, Once you have deployed the Postgres cluster and pod monitors, you can create a metrics dashboard on the Managed Grafana instance created by the deployment script to visualize the metrics exported to the Azure Monitor workspace. You can access the Managed Grafana via the Azure portal. Navigate to the Managed Grafana instance created by the deployment script and click on the Endpoint link as shown here:
305307
![Azure Managed Grafana Instance](./media/deploy-postgresql-ha/cnpg-graf-1.png)
306308

307309
Clicking on the Endpoint link will cause a new browser window to open where you can create dashboards on the Managed Grafana instance. Following the instructions to [configure an Azure Monitor data source](https://learn.microsoft.com/en-us/azure/azure-monitor/visualize/grafana-plugin#configure-an-azure-monitor-data-source-plug-in), you can then add visualizations to create a dashboard of metrics from the Postgres cluster. After setting up the data source connection, from the main menu, click the Data sources option and you should see a set of data source options for the data source connection as shown here:
308310
![Data Source Options](./media/deploy-postgres-ha/cnpg-graf-2.png)
309311

310-
On the Managed Prometheus option, click the option to build a dashboard to open the dashboard editor. Once the
311-
editor window opens, click the Add visualization option then click the Managed Prometheus option to browse the metrics from the Postgres cluster. Once you have selected the metric you want to visualize, click the Run queries button to fetch the data for the visualization as shown here:
312+
On the Managed Prometheus option, click the option to build a dashboard to open the dashboard editor. Once the editor window opens, click the Add visualization option then click the Managed Prometheus option to browse the metrics from the Postgres cluster. Once you have selected the metric you want to visualize, click the Run queries button to fetch the data for the visualization as shown here:
312313
![Dashboard](./media/deploy-postgres-ha/cnpg-graf-3.png)
313314

314315
Click the Save button to add the panel to your dashboard. You can add other panels by clicking the Add button in the dashboard editor and repeating this process to visualize other metrics. Adding the metrics visualizations, you should have something that looks like this:
@@ -332,23 +333,23 @@ Your output should resemble the following example output with the availability z
332333
```output
333334
{
334335
"node": "aks-postgres-15810965-vmss000000",
335-
"zone": "eastus-1"
336+
"zone": "westus3-1"
336337
}
337338
{
338339
"node": "aks-postgres-15810965-vmss000001",
339-
"zone": "eastus-2"
340+
"zone": "westus3-2"
340341
}
341342
{
342343
"node": "aks-postgres-15810965-vmss000002",
343-
"zone": "eastus-3"
344+
"zone": "westus3-3"
344345
}
345346
{
346347
"node": "aks-systempool-26112968-vmss000000",
347-
"zone": "eastus-1"
348+
"zone": "westus3-1"
348349
}
349350
{
350351
"node": "aks-systempool-26112968-vmss000001",
351-
"zone": "eastus-2"
352+
"zone": "westus3-2"
352353
}
353354
```
354355

@@ -375,7 +376,6 @@ In this section, you create a table and insert some data into the app database t
375376
376377
## Connect to PostgreSQL read-only replicas
377378
378-
379379
* Connect to the PostgreSQL read-only replicas and validate the sample dataset using the following commands:
380380
381381
```azurecli-interactive
@@ -407,7 +407,8 @@ In this section, you create a table and insert some data into the app database t
407407
```
408408
409409
Example output
410-
```output
410+
411+
```output
411412
Continuous Backup status
412413
First Point of Recoverability: Not Available
413414
Working WAL archiving: FAILING
@@ -439,6 +440,7 @@ In this section, you create a table and insert some data into the app database t
439440
```
440441
441442
Example output
443+
442444
```output
443445
Type Reason Age From Message
444446
---- ------ ---- ---- -------
@@ -454,6 +456,7 @@ In this section, you create a table and insert some data into the app database t
454456
```
455457
456458
Example output
459+
457460
```output
458461
Continuous Backup status
459462
First Point of Recoverability: 2024-06-05T13:47:18Z
@@ -579,7 +582,7 @@ You also create a second federated credential to map the new recovery cluster se
579582
storage: 2Gi
580583
storageClassName: managed-csi-premium
581584
volumeMode: Filesystem
582-
585+
583586
serviceAccountTemplate:
584587
metadata:
585588
annotations:
@@ -646,6 +649,7 @@ You also retrieve the following endpoints from the Cluster IP service:
646649
```
647650
648651
Example output
652+
649653
```output
650654
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
651655
pg-primary-cnpg-sryti1qf-r ClusterIP 10.0.193.27 <none> 5432/TCP 3h57m
@@ -726,7 +730,7 @@ You also retrieve the following endpoints from the Cluster IP service:
726730
EOF
727731
```
728732
729-
4. Get the service details using the [`kubectl describe`][kubectl-describe] command.
733+
1. Get the service details using the [`kubectl describe`][kubectl-describe] command.
730734
731735
```azurecli-interactive
732736
kubectl describe service cnpg-cluster-load-balancer-rw \
@@ -738,9 +742,9 @@ You also retrieve the following endpoints from the Cluster IP service:
738742
--namespace $PG_NAMESPACE
739743
740744
export AKS_PRIMARY_CLUSTER_ALB_DNSNAME="$(az network public-ip show \
741-
--resource-group $AKS_PRIMARY_CLUSTER_NODERG_NAME \
742-
--name $AKS_PRIMARY_CLUSTER_PUBLICIP_NAME \
743-
--query "dnsSettings.fqdn" --output tsv)"
745+
--resource-group $AKS_PRIMARY_CLUSTER_NODERG_NAME \
746+
--name $AKS_PRIMARY_CLUSTER_PUBLICIP_NAME \
747+
--query "dnsSettings.fqdn" --output tsv)"
744748
745749
echo $AKS_PRIMARY_CLUSTER_ALB_DNSNAME
746750
```
@@ -799,6 +803,7 @@ In this section, you trigger a sudden failure by deleting the pod running the pr
799803
```
800804
801805
Example output
806+
802807
```output
803808
Name Current LSN Rep role Status Node
804809
--------------------------- ----------- -------- ------- -----------
@@ -825,6 +830,7 @@ In this section, you trigger a sudden failure by deleting the pod running the pr
825830
```
826831
827832
Example output
833+
828834
```output
829835
pg-primary-cnpg-sryti1qf-2 0/9000060 Primary OK aks-postgres-32388626-vmss000001
830836
pg-primary-cnpg-sryti1qf-1 0/9000060 Standby (sync) OK aks-postgres-32388626-vmss000000
@@ -844,6 +850,7 @@ In this section, you trigger a sudden failure by deleting the pod running the pr
844850
```
845851
846852
Example output
853+
847854
```output
848855
Name Current LSN Rep role Status Node
849856
--------------------------- ----------- -------- ------- -----------
@@ -856,7 +863,7 @@ In this section, you trigger a sudden failure by deleting the pod running the pr
856863
857864
* Once you're finished reviewing your deployment, delete all the resources you created in this guide using the [`az group delete`][az-group-delete] command.
858865
859-
```azurecli-interactive
866+
```azurecli-interactive
860867
az group delete --resource-group $RESOURCE_GROUP_NAME --no-wait --yes
861868
```
862869

0 commit comments

Comments
 (0)