Chapter 3: Introduction to Kubernetes
Activity 3: Installing a WordPress Blog and Database on Kubernetes
Solution:
Perform the following steps to complete this activity:
- Create a two-container stateful set definition inside the wordpress-database.yaml file with the following specifications:
The nme should be wordpress-database and the replica count should be set to 1. The database container should have the name of database and use the container image of mysql:5.7. Publish the container to port 3306 and mount the data volume to the /var/lib/mysql path. In addition, set the following environment variables:
Figure 3.24: Environment variables
Create a blog container with the name blog using the latest WordPress container image and publish the container to port 80. In addition, set the following environment variables:
Figure 3.25: Environment variables
Include a volume claim with the name data and 1GB storage.
The stateful set description as YAML for the specification is as follows:
apiVersion: apps...