Skip to content

Commit 834ade0

Browse files
committed
Fix wordpress style
1 parent 62ed18a commit 834ade0

File tree

1 file changed

+49
-82
lines changed

1 file changed

+49
-82
lines changed

scenarios/azure-databases-docs/articles/mysql/flexible-server/tutorial-deploy-wordpress-on-aks.md

Lines changed: 49 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -121,14 +121,10 @@ Results:
121121

122122
Azure Database for MySQL flexible server is a managed service that you can use to run, manage, and scale highly available MySQL servers in the cloud. Create an Azure Database for MySQL flexible server instance with the [az mysql flexible-server create](/cli/azure/mysql/flexible-server) command. A server can contain multiple databases. The following command creates a server using service defaults and variable values from your Azure CLI's local context:
123123

124-
```bash
125-
export MY_MYSQL_ADMIN_USERNAME="dbadmin$RANDOM_ID"
126-
export MY_WP_ADMIN_PW="$(openssl rand -base64 32)"
127-
```
128-
129124
```bash
130125
export MY_DNS_LABEL="mydnslabel$RANDOM_ID"
131126
export MY_MYSQL_DB_NAME="mydb$RANDOM_ID"
127+
export MY_MYSQL_ADMIN_USERNAME="dbadmin$RANDOM_ID"
132128
export MY_MYSQL_ADMIN_PW="$(openssl rand -base64 32)"
133129
export MY_MYSQL_SN_NAME="myMySQLSN$RANDOM_ID"
134130
az mysql flexible-server create \
@@ -266,22 +262,22 @@ To manage a Kubernetes cluster, use [kubectl](https://kubernetes.io/docs/referen
266262
if ! [ -x "$(command -v kubectl)" ]; then az aks install-cli; fi
267263
```
268264

269-
Next, configure `kubectl` to connect to your Kubernetes cluster using the [az aks get-credentials](/cli/azure/aks#az-aks-get-credentials) command. This command downloads credentials and configures the Kubernetes CLI to use them. The command uses `~/.kube/config`, the default location for the [Kubernetes configuration file](https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig/). You can specify a different location for your Kubernetes configuration file using the **--file** argument.
265+
## Load credentials
270266

271-
> [!WARNING]
272-
> This command will overwrite any existing credentials with the same entry.
267+
Next, configure `kubectl` to connect to your Kubernetes cluster using the [az aks get-credentials](/cli/azure/aks#az-aks-get-credentials) command. This command downloads credentials and configures the Kubernetes CLI to use them. The command uses `~/.kube/config`, the default location for the [Kubernetes configuration file](https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig/). You can specify a different location for your Kubernetes configuration file using the **--file** argument.
273268

274269
```bash
275270
az aks get-credentials --resource-group $MY_RESOURCE_GROUP_NAME --name $MY_AKS_CLUSTER_NAME --overwrite-existing
276271
```
277272

273+
## Verify Connection
278274
To verify the connection to your cluster, use the [kubectl get]( https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#get) command to return a list of the cluster nodes.
279275

280276
```bash
281277
kubectl get nodes
282278
```
283279

284-
## Install NGINX ingress controller
280+
## Setup FQDN
285281

286282
You can configure your ingress controller with a static public IP address. The static public IP address remains if you delete your ingress controller. The IP address doesn't remain if you delete your AKS cluster.
287283
When you upgrade your ingress controller, you must pass a parameter to the Helm release to ensure the ingress controller service is made aware of the load balancer that will be allocated to it. For the HTTPS certificates to work correctly, use a DNS label to configure a fully qualified domain name (FQDN) for the ingress controller IP address. Your FQDN should follow this form: $MY_DNS_LABEL.AZURE_REGION_NAME.cloudapp.azure.com.
@@ -291,6 +287,8 @@ export MY_PUBLIC_IP_NAME="myPublicIP$RANDOM_ID"
291287
export MY_STATIC_IP=$(az network public-ip create --resource-group MC_${MY_RESOURCE_GROUP_NAME}_${MY_AKS_CLUSTER_NAME}_${REGION} --location ${REGION} --name ${MY_PUBLIC_IP_NAME} --dns-name ${MY_DNS_LABEL} --sku Standard --allocation-method static --version IPv4 --zone 1 2 3 --query publicIp.ipAddress -o tsv)
292288
```
293289

290+
## Install NGINX ingress controller
291+
294292
Next, you add the ingress-nginx Helm repository, update the local Helm Chart repository cache, and install ingress-nginx addon via Helm. You can set the DNS label with the **--set controller.service.annotations."service\.beta\.kubernetes\.io/azure-dns-label-name"="<DNS_LABEL>"** parameter either when you first deploy the ingress controller or later. In this example, you specify your own public IP address that you created in the previous step with the **--set controller.service.loadBalancerIP="<STATIC_IP>" parameter**.
295293

296294
```bash
@@ -312,60 +310,37 @@ At this point in the tutorial, you have an AKS web app with NGINX as the ingress
312310
### Set Up Cert Manager
313311

314312
To add HTTPS, we're going to use Cert Manager. Cert Manager is an open source tool for obtaining and managing SSL certificates for Kubernetes deployments. Cert Manager obtains certificates from popular public issuers and private issuers, ensures the certificates are valid and up-to-date, and attempts to renew certificates at a configured time before they expire.
315-
316313
1. In order to install cert-manager, we must first create a namespace to run it in. This tutorial installs cert-manager into the cert-manager namespace. You can run cert-manager in a different namespace, but you must make modifications to the deployment manifests.
317-
318-
```bash
319-
kubectl create namespace cert-manager
320-
```
321-
322314
2. We can now install cert-manager. All resources are included in a single YAML manifest file. Install the manifest file with the following command:
323-
324-
```bash
325-
kubectl apply -f https://github.com/jetstack/cert-manager/releases/download/v1.7.0/cert-manager.crds.yaml
326-
```
327-
328315
3. Add the `certmanager.k8s.io/disable-validation: "true"` label to the cert-manager namespace by running the following. This allows the system resources that cert-manager requires to bootstrap TLS to be created in its own namespace.
329316

330-
```bash
331-
kubectl label namespace cert-manager certmanager.k8s.io/disable-validation=true
332-
```
317+
```bash
318+
kubectl create namespace cert-manager
319+
kubectl apply -f https://github.com/jetstack/cert-manager/releases/download/v1.7.0/cert-manager.crds.yaml
320+
kubectl label namespace cert-manager certmanager.k8s.io/disable-validation=true
321+
```
333322

334323
## Obtain certificate via Helm Charts
335324

336325
Helm is a Kubernetes deployment tool for automating the creation, packaging, configuration, and deployment of applications and services to Kubernetes clusters.
337-
338326
Cert-manager provides Helm charts as a first-class method of installation on Kubernetes.
339-
340327
1. Add the Jetstack Helm repository. This repository is the only supported source of cert-manager charts. There are other mirrors and copies across the internet, but those are unofficial and could present a security risk.
341-
342-
```bash
343-
helm repo add jetstack https://charts.jetstack.io
344-
```
345-
346328
2. Update local Helm Chart repository cache.
347-
348-
```bash
349-
helm repo update
350-
```
351-
352329
3. Install Cert-Manager addon via Helm.
353-
354-
```bash
355-
helm upgrade --install --cleanup-on-fail --atomic \
356-
--namespace cert-manager \
357-
--version v1.7.0 \
358-
--wait --timeout 10m0s \
359-
cert-manager jetstack/cert-manager
360-
```
361-
362330
4. Apply the certificate issuer YAML file. ClusterIssuers are Kubernetes resources that represent certificate authorities (CAs) that can generate signed certificates by honoring certificate signing requests. All cert-manager certificates require a referenced issuer that is in a ready condition to attempt to honor the request. You can find the issuer we're in the `cluster-issuer-prod.yml file`.
363331

364-
```bash
365-
export SSL_EMAIL_ADDRESS="$(az account show --query user.name --output tsv)"
366-
cluster_issuer_variables=$(<cluster-issuer-prod.yaml)
367-
echo "${cluster_issuer_variables//\$SSL_EMAIL_ADDRESS/$SSL_EMAIL_ADDRESS}" | kubectl apply -f -
368-
```
332+
```bash
333+
helm repo add jetstack https://charts.jetstack.io
334+
helm repo update
335+
helm upgrade --install --cleanup-on-fail --atomic \
336+
--namespace cert-manager \
337+
--version v1.7.0 \
338+
--wait --timeout 10m0s \
339+
cert-manager jetstack/cert-manager
340+
export SSL_EMAIL_ADDRESS="$(az account show --query user.name --output tsv)"
341+
cluster_issuer_variables=$(<cluster-issuer-prod.yaml)
342+
echo "${cluster_issuer_variables//\$SSL_EMAIL_ADDRESS/$SSL_EMAIL_ADDRESS}" | kubectl apply -f -
343+
```
369344

370345
## Create a custom storage class
371346

@@ -379,39 +354,32 @@ kubectl apply -f wp-azurefiles-sc.yaml
379354
## Deploy WordPress to AKS cluster
380355

381356
For this tutorial, we're using an existing Helm chart for WordPress built by Bitnami. The Bitnami Helm chart uses a local MariaDB as the database, so we need to override these values to use the app with Azure Database for MySQL. You can override the values and the custom settings the `helm-wp-aks-values.yaml` file.
382-
383357
1. Add the Wordpress Bitnami Helm repository.
384-
385-
```bash
386-
helm repo add bitnami https://charts.bitnami.com/bitnami
387-
```
388-
389358
2. Update local Helm chart repository cache.
390-
391-
```bash
392-
helm repo update
393-
```
394-
395359
3. Install Wordpress workload via Helm.
396360

397-
```bash
398-
export MY_MYSQL_HOSTNAME="$MY_MYSQL_DB_NAME.mysql.database.azure.com"
399-
export MY_WP_ADMIN_USER="wpcliadmin"
400-
export FQDN="${MY_DNS_LABEL}.${REGION}.cloudapp.azure.com"
401-
helm upgrade --install --cleanup-on-fail \
402-
--wait --timeout 10m0s \
403-
--namespace wordpress \
404-
--create-namespace \
405-
--set wordpressUsername="$MY_WP_ADMIN_USER" \
406-
--set wordpressPassword="$MY_WP_ADMIN_PW" \
407-
--set wordpressEmail="$SSL_EMAIL_ADDRESS" \
408-
--set externalDatabase.host="$MY_MYSQL_HOSTNAME" \
409-
--set externalDatabase.user="$MY_MYSQL_ADMIN_USERNAME" \
410-
--set externalDatabase.password="$MY_MYSQL_ADMIN_PW" \
411-
--set ingress.hostname="$FQDN" \
412-
--values helm-wp-aks-values.yaml \
413-
wordpress bitnami/wordpress
414-
```
361+
```bash
362+
helm repo add bitnami https://charts.bitnami.com/bitnami
363+
helm repo update
364+
365+
export MY_MYSQL_HOSTNAME="$MY_MYSQL_DB_NAME.mysql.database.azure.com"
366+
export MY_WP_ADMIN_USER="wpcliadmin"
367+
export MY_WP_ADMIN_PW="$(openssl rand -base64 32)"
368+
export FQDN="${MY_DNS_LABEL}.${REGION}.cloudapp.azure.com"
369+
helm upgrade --install --cleanup-on-fail \
370+
--wait --timeout 10m0s \
371+
--namespace wordpress \
372+
--create-namespace \
373+
--set wordpressUsername="$MY_WP_ADMIN_USER" \
374+
--set wordpressPassword="$MY_WP_ADMIN_PW" \
375+
--set wordpressEmail="$SSL_EMAIL_ADDRESS" \
376+
--set externalDatabase.host="$MY_MYSQL_HOSTNAME" \
377+
--set externalDatabase.user="$MY_MYSQL_ADMIN_USERNAME" \
378+
--set externalDatabase.password="$MY_MYSQL_ADMIN_PW" \
379+
--set ingress.hostname="$FQDN" \
380+
--values helm-wp-aks-values.yaml \
381+
wordpress bitnami/wordpress
382+
```
415383

416384
Results:
417385
<!-- expected_similarity=0.3 -->
@@ -455,10 +423,7 @@ To access your WordPress site from outside the cluster follow the steps below:
455423

456424
## Browse your AKS deployment secured via HTTPS
457425

458-
Run the following command to get the HTTPS endpoint for your application:
459-
460-
> [!NOTE]
461-
> It often takes 2-3 minutes for the SSL certificate to propagate and about 5 minutes to have all WordPress POD replicas ready and the site to be fully reachable via https.
426+
Wait for the cluster to setup. It often takes 2-3 minutes for the SSL certificate to propagate and about 5 minutes to have all WordPress POD replicas ready and the site to be fully reachable via https.
462427

463428
```bash
464429
runtime="5 minute"
@@ -474,6 +439,7 @@ while [[ $(date -u +%s) -le $endtime ]]; do
474439
done
475440
```
476441

442+
## Verify Site works
477443
Check that WordPress content is delivered correctly using the following command:
478444

479445
```bash
@@ -500,6 +466,7 @@ Results:
500466
}
501467
```
502468

469+
## Visit Application
503470
Visit the website through the following URL:
504471

505472
```bash

0 commit comments

Comments
 (0)