WordPress must be used together with MySQL. WordPress runs the content management program while MySQL serves as a database to store data.
You have created a CCE cluster that contains a node with 4 vCPUs and 8 GiB memory. For details on how to create a cluster, see Creating a Kubernetes Cluster.
Enter mysql:5.7 in the Image Name text box.
/bin/bash
-c rm -rf /var/lib/mysql/lost+found;docker-entrypoint.sh mysqld;
Click Create PVC and configure the following parameters (Keep default for other parameters):
Click Create and enter the path for mounting the storage volume to the container. The default path used by MySQL is /var/lib/mysql.
A headless Service needs to be configured for the StatefulSet networking. The headless Service generates DNS name for each pod for accessing a specific StatefulSet pod. For a replicated MySQL database, the headless Service needs to be used to read and write the MySQL primary server, and copies existing data from other running replicas. In this example, there is only one pod running in the MySQL workload. Therefore, the headless Service is not used. In this case, enter 3306 for both the Service port and container port. For details about the replicated MySQL examples, see Run a Replicated Stateful Application.
Select ClusterIP for Service Type, enter mysqlin the Service Name text box, set both the Container Port and Service Port to 3306, and click OK.
The default access port in the MySQL image is 3306. In this example, both the container port and Service port are set to 3306 for convenience. The access port can be changed to another port.
In this way, the MySQL workload can be accessed through {Service name}:{Access port} (for example, mysql:3306) from within the cluster.
Wait until the workload is created.
The created Deployment will be displayed on the StatefulSets tab.