|
2 | 2 |
|
3 | 3 | [Watch demo here](https://www.youtube.com/watch?v=H9RJBXPBxUY&t=1s) |
4 | 4 |
|
5 | | -## Componenets |
6 | | - |
| 5 | +## Components |
7 | 6 | - Kubernetes |
8 | | -- MySQLServer, MySQLDatabase, MySQLFirewalule |
9 | | -- Wordpress |
10 | | -- Persistent Volume Storage |
| 7 | +- MySqlServer, MySqlDatabase, MySqlFirewallRule |
| 8 | +- Persistent Volume Claims |
11 | 9 | - Application Insights |
12 | 10 |
|
13 | | -## Creating our resources |
| 11 | +## Creating Azure Resources |
| 12 | + |
| 13 | +Our Azure resources are in the manifests folder. Open up the manifests folder to edit the yaml files. |
| 14 | + |
| 15 | +### Resource Group |
| 16 | + |
| 17 | +Update the name field to your desired resource group name |
| 18 | + |
| 19 | +Create the ResourceGroup |
| 20 | + |
| 21 | +`k create -f azure_v1alpha1_resourcegroup.yaml` |
| 22 | +
Verify Creation |
| 23 | +`k get resourcegroup [resourcegroupname] -o yaml` |
| 24 | + |
| 25 | +### MySqlServer |
| 26 | + |
| 27 | +Update the name field to your own unique mysqlserver name, with the same resource group name from before |
| 28 | + |
| 29 | +Create the MySqlServer |
| 30 | +`k create -f azure_v1alpha1_mysqlserver.yaml` |
| 31 | + |
| 32 | +Verify Creation |
| 33 | +`k get mysqlserver [mysqlservername] -o yaml` |
| 34 | + |
| 35 | +### MySqlServerDatabase |
| 36 | + |
| 37 | +Update the name field to your own unique mysqldatabase name, with the same resource group name and server from before. |
| 38 | + |
| 39 | +Create the MySqlServerDatabase |
| 40 | +`k create -f azure_v1alpha1_mysqldatabase.yaml` |
| 41 | + |
| 42 | +Verify Creation |
| 43 | +`k get mysqldatabase [mysqlserverdatabasename] -o yaml` |
| 44 | + |
| 45 | +### MySqlFirewallRule |
| 46 | + |
| 47 | +Update the name field to your own unique mysqlfirewallrule name, with the same resource group name and server from before. |
| 48 | + |
| 49 | +Create the MySqlFirewallRule |
| 50 | +`k create -f azure_v1alpha1_mysqlfirewallruleyaml` |
14 | 51 |
|
15 | | -Run the Azure Service operators with a `make install` and `make run` in one terminal |
| 52 | +Verify Creation |
| 53 | +`k get mysqlfirewallrule [mysqlfirewallrulename] -o yaml` |
16 | 54 |
|
17 | | -Create the Azure resources above using deploy.yaml in the manifest folder in another terminal |
18 | | -`kubectl apply -f ./` |
| 55 | +### AppInsights |
19 | 56 |
|
20 | | -Check the deployment |
| 57 | +Update the name field to your own unique insights name, with the same resource group name from before. |
| 58 | + |
| 59 | +Create the App Insights: |
| 60 | +`kubectl create -f azure_v1alpha1_appinsights.yaml` |
| 61 | + |
| 62 | +Verify Creation |
| 63 | +`kubectl get app insights [appinsightsname] -o yaml` |
| 64 | + |
| 65 | +## Deploying Wordpress |
| 66 | + |
| 67 | +Inside of the deploy.yaml, we will create our Wordpress image using our azure resources we created previously. We need to update this deploy.yaml file with the correct environment variables |
| 68 | + |
| 69 | +- WORDPRESS_DB_HOST: MySqlDatabase host path + port. The host path is listed in the azure portal as the server name. |
| 70 | +- WORDPRESS_DB_NAME: MySqlServerDatabase name |
| 71 | +- WORDPRESS_DB_USER: The username generated from our MySqlServer - also listed in the Azure portal |
| 72 | +- WORDPRESS_DB_HOST: The password generated from our MySqlServer |
| 73 | + |
| 74 | +To check the values of our secret holding our password field, do a get. |
| 75 | +`kubectl get secrets [mysqlservername] -o yaml` |
| 76 | + |
| 77 | +*Note* |
| 78 | +If you would like add any other wordpress env variables, you can find documentation on the docker image for Wordpress [here](https://hub.docker.com/_/wordpress/) |
| 79 | + |
| 80 | + |
| 81 | +### Persistent Volume Claims |
| 82 | + |
| 83 | +Our persistent volume claims are also listed inside of the manifests file. You can create these separately if you would like using |
| 84 | + |
| 85 | +Create |
| 86 | +`kubectl create -f azure_v1alpha1_pvc.yaml` |
| 87 | + |
| 88 | +Verify |
| 89 | +`kubectl get pvc [pvcnames] -o yaml` |
| 90 | + |
| 91 | +Once our environment variables are set, bound, and successfully provisioned, we can create our deployment |
| 92 | + |
| 93 | +`kubectl apply -f ./‘ |
| 94 | + |
| 95 | +Check the status of our deployment |
21 | 96 | `kubectl get deployment` |
22 | 97 |
|
23 | 98 | Check for running pods |
24 | 99 | `kubectl get pods` |
| 100 | +
Once the pods are running, we can port-forward our webpage and view it in a browser |
| 101 | +`kubectl port-forward [podname] [newport]:[oldport]` |
| 102 | + |
| 103 | + |
| 104 | +Now the wordpress site is ready and we can begin customizing! |
25 | 105 |
|
26 | | -Port forward the webpage |
27 | | -`kubectl port-forward [podname] [newport]:[old port]` |
| 106 | +You can use the [MySqlServer Workbench](https://www.mysql.com/products/workbench/) |
| 107 | +to view the data from the MySqlDatabase |
0 commit comments