posted

0 Comments

This blog is written by Balu Dontu and Tushar Thole from Cloud Native Applications Storage team

See Part 1 of the blog: Deploying WordPress-MySQL Application with Persistent Storage


Create deployment with Persistent Volume Claim

Create a MySql deployment

Create a MySql deployment using this resource file:

 

Key parts here are:

  • Resource defines a Deployment using mysql Docker image
  • volumeMounts define which volumes are going to be mounted. /var/lib/mysql is the directory where sqlDB Server stores all the data.
  • volumes define different volumes that can be used in this deployment definition. Here we are using mysql-pv-claim.

Create the Deployment as:

Create a WordPress deployment

Create a WordPress deployment using this resource file:

Key parts here are:

  • Resource defines a Deployment using wordpress Docker image
  • volumeMounts define which volumes are going to be mounted. /var/www/html is the directory where wordpress stores all the data.
  • volumes define different volumes that can be used in this deployment definition. Here we are using wp-pv-claim.

Create the Deployment as:

Now let’s see where the WordPress pod is deployed.


 

After the deployment is created, you can see below the volume is successfully attached to the node4 where WordPress pod is deployed.
balu_blog_img1 
Also you can clearly see that the persistent volume attached to node4 is provisioned with vSAN policy. Since it has 2 hostFailuresToTolerate and 2 diskStripes, the copies are spread across 6 hosts with 3 copies on the disk and 2 stripes of the disk on the ESX host.
 
balu_blog_img2
 
After the pod is successfully deployed on one of the nodes, enter the following command to get the IP address and port to access the blog,

Just enter this ‘10.160.241.61:30080’ in the browser to visit WordPress blog.

You’ll see the familiar WordPress start page:

balu_blog_img3

As you can see, with just a few additional lines in your storage class YAML, vSphere Cloud Provider enables policy driven dynamic provisioning of Kubernetes persistent volumes. It exposes data services offered by the underlying storage platform such as vSAN at granularity of container volumes and provides applications a complete abstraction of storage infrastructure.

We would love to hear your feedback! We will be at DockerCon. Please drop by at booth G9 to learn more about what we have to offer.