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.
1env:2 - name: MYSQL_ROOT_PASSWORD3 valueFrom:4 secretKeyRef:5 name: mysql-pass6 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=
.
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-pass
Opaque
password: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-pv
manual
ReadWriteOnce
Figure: Configure persistent volume
1- Scroll down to "Capacity" and enter the key pair `storage:20Gi`
Figure: Persistent volume capacity
1- Scroll down to "Hostpath" and input `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-pv
manual
ReadWriteOnce
storage:20Gi
mnt/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
.