docs/static/v0.8/guides/tutorials/wordpress-mysql-persistentvolume/index.html
In this tutorial, we will learn how to deploy a WordPress site and a MySQL database with Persistent Volumes using Meshery Playground. Meshery Playground is an interactive and collaborative live cluster environment that simplifies the deployment process and enhances user experience by providing visual tools for managing Kubernetes resources.
NOTE: If this is your first time working with Meshery Playground, consider starting with the Exploring Kubernetes Pods with Meshery Playground tutorial first.
Import the WordPress and MySQL manifest files into Meshery Playground.
Create persistent volumes and a secret for the resources using the visual tools provided by Meshery.
Deploy these resources on the playground.
In this lab, you will import the WordPress and MySQL manifest files into Meshery Playground. You will visualize these Kubernetes resources and create persistent volumes for them using the visual tools provided by Meshery. Finally, you will deploy these resources on the Playground.
Learn how to import manifest files, visualize Kubernetes resources, create new resource components, and deploy the application using Meshery Playground.
Go ahead and download these yaml files mysql-deployment.yaml and wordpress-deployment.yaml
These YAML files contain the Service definitions, Persistent Volume Claims, and Deployment configurations for the WordPress site and the MySQL database.
Log in to the Meshery Playground using your credentials. On successful login, you should be at the dashboard. Press the X on the Where do you want to start? popup to close it (if required).
Click Explore in the Cloud Native Playground tile to navigate to Kanvas
In the left sidebar, click on the upward arrow symbol(import icon) to import the designs into Meshery.
In the modal that appears:
Enter a name for your design in the “Design File Name” field (e.g.mysql-deployment).
Select Kubernetes Manifest from the “Design Type” dropdown menu.
Choose File Upload for the upload method, and select the file you just downloaded.
Then, click on Import
Under the “Designs” tab, you will see that we have successfully imported the mysql-deployment design.
Now, follow the same steps to import the wordpress-deployment file.
Next, we will combine the WordPress and MySQL designs into a single design file. By merging these designs, we can manage and deploy both resources together.
To merge the MySQL deployment design with the WordPress deployment design:/
Click and drag the mysql-deployment design from the left panel and drop it onto the design canvas of the wordpress-deployment.
This action will open a merge modal asking if you want to merge the design, Click on Merge.
Click on Save As and enter wordpress-mysql-deployment as the new file name.
In this step, we need to create a Kubernetes secret component for the MySQL database. This is necessary because of this configuration in the environment variables section of the mysql-deployment yaml file.
env:
- name: MYSQL_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: mysql-pass
key: password
Before you proceed, choose a password and convert it into base64 format. You can use an online tool for this conversion. For this example the password is password and its base64 encoding is cGFzc3dvcmQ=
Click on the Kubernetes icon on the dock, search for secret, and click on it or drag it to the canvas.
Click on the Secret component to open the configuration window.
Click outside the window to close the configuration tab.
MySQL and WordPress each require a Persistent Volume(PV) to store their data.
For this tutorial, we will use the manual StorageClassName and set the Persistent Volume to use the hostPath type.
Please note that using hostPath for Persistent Volumes is generally not recommended for production environments because it ties the volume to the node’s filesystem, which can lead to data loss if the node fails. However, we can use it in this tutorial for development purposes.
Click on the Kubernetes icon on the dock, search for Persistent Volume, and select it. We will create two PV’s.
Click on the wordpress PV to open the configuration window.
Repeat similar steps for the Mysql Persistent Volume
Click on wp-pv-claim and mysql-pv-claim and set their “StorageClassName” as manual
To make it easier to filter and manage our resources during visualization, let’s add labels to all of them.
You can also choose to use the existing label, app:wordpress, but a new one, dev:tutorial, is recommended for this tutorial to prevent our resources from getting mixed up with others in the public playground cluster.
Click on the label icon.
Click the + sign next to Labels.
Add the label dev:tutorial.
Do this for all the resources on the canvas.
Now click on Save As and save the design.
The _ Group Components _ icon on the dock below allows you to group resources based on shared labels or annotations.
This functionality aids in visualizing the relationships between various resources, making it easier to manage them, troubleshoot issues, and understand the overall cluster architecture.
Click Actions in the top right corner and click on Deploy.
The design will be validated to make sure there are no errors.
Choose the Kubernetes cluster you want to deploy to.
Finally click Deploy to deploy the application to the cluster.
To check the status of your deployment, click on the notification icon on the top right corner. You can click on Open In visualizer to navigate to the Visualize section or follow the steps below.
To view the resources deployed we will use the Visualize section of the Kanvas. In this section, you can apply filters to display the specific resources you want to see.
Move to the Visualize tab.
Click the filter icon and choose the appropriate filters
You can also use the icons on the right sidebar to filter the resources.
You can click on any resource to view more details about it in the “Details” section on the right sidebar.
Deployment
Service
The Service details only display the cluster IP for now. So there is no means for us to access the application externally.
To delete the resources, use the Undeploy option from the Action dropdown in the Design tab.
Congratulations! You’ve successfully completed the tutorial on deploying a WordPress site and MySQL database with Persistent Volumes using Meshery Playground. This hands-on experience should have given you valuable insights into importing manifest files, visualizing resources, creating persistent volumes, and managing deployments in Meshery Playground.