In this step, you create a Kubernetes secret component for the MySQL database. This is necessary because the configuration below is in the environment variables section of the mysql-deployment YAML file.
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=.
secret, and click on it or drag it to the canvas.
Figure: Create secret component
Click on the Secret component to open the configuration window.
mysql-passOpaquepassword:cGFzc3dvcmQ=
Figure: Configure secret
MySQL and WordPress each require a Persistent Volume (PV) to store their data.
For this tutorial, you 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, you can use it in this tutorial for development purposes.
Persistent Volume, and select it. Create two PVs.
Figure: Create persistent volume
Click on the wordpress PV to open the configuration window.
wp-pvmanualReadWriteOnce
Figure: Configure persistent volume
storage:20Gi
Figure: Persistent volume capacity
mnt/data/wp-pv for the path and DirectoryOrCreate for the type.
Figure: Persistent volume hostpath
Repeat similar steps for the MySQL Persistent Volume
mysql-pvmanualReadWriteOncestorage:20Gimnt/data/mysql-pv for the path and DirectoryOrCreate for the type.Click on wp-pv-claim and mysql-pv-claim and set their "StorageClassName" as manual.