Deploying WordPress on a DigitalOcean Kubernetes Cluster with Containership

wordpress

One of the most popular content management systems is WordPress-- so much so that it makes up roughly 25% of websites on the internet today. So naturally finding a good way to host WordPress is a common problem that technical and non technical people face daily. While there are a number of hosted options available, they are often lacking when it comes to scaling, both in terms of cost and feasibility.

As a result, users are looking for new ways to manage one or more WordPress sites and looking to containers to make that possible. The big question remains though, how do I get my containerized WordPress site to the cloud? At some point the typical user arrives at Kubernetes, but that can be like opening to the first page of an encyclopedia. What is Kubernetes and how the heck do you even pronounce it? Look no further, here is a simple approach to getting your WordPress site up and going with Containership Cloud using the Containership Kubernetes Engine

The first step is determining which provider you would like to host your site on. For the purpose of this article I will be using DigitalOcean. The main reason is that DigitalOcean offers affordable pricing and is a more viable option to those looking to simply get their site up and running for cheap. For larger, more complex sites, perhaps another provider is a better fit. It is really your call!

Launching The Cluster

I am going to breeze over this section as we have other resources available that you can reference to get your cluster up and running. There are 4 main steps:

  1. Sign Up for DigitalOcean
  2. Sign Up for Containership
  3. Connect DigitalOcean to Containership
  4. Launch your cluster on DigitalOcean


Once the above steps have been completed, you are ready to get your scalable WordPress site deployed on DigitalOcean!

Deploy Secret

In order for your WordPress container to communicate with mySQL, a secret is required between them. Typically, you would need to use kubectl to add your secret in. With Containership you can do it directly within the UI.

Click the create button and select resource

create

From the resource creation window make sure the correct cluster is selected. Then copy in the following YAML. Be sure to update the password that best works for you. This will be used if you need to access mySQL later.

The create button becomes available and you can double check that your secret is deployed by going to the configuration in the left navigation of the cluster.

secret

Deploying mySQL

Now you are ready to deploy your mySQL database to the cluster.

Click the create button and select resource:

create

Copy the following YAML definition into the resource creation tool: 

NOTE: This YAML is specific to DigitalOcean and will be different if you choose another provider

The create button becomes available and you can double check that your deployment worked by going to the workloads in the cluster.

The workload will appear red at first as the image is pulled and typically takes 1-3 minutes to get fully stood up. Once mySQL is up an running it will appear as green after a page refresh.

sqldeploy 

Deploy Wordpress

Now that you have your database and secrets all taken care of. It is time to deploy WordPress itself.

Click the create button and select resource

create

Copy the following YAML definition into the resource creation tool: 

NOTE: This YAML is specific to DigitalOcean and will be different if you choose another provider

The create button becomes available and you can double check that your secret is deployed by going to the workloads in the cluster. The workload will appear red at first as the image is pulled and typically takes 1-3 minutes to get fully stood up. Once WordPress is up an running it will appear as green after a page refresh.

Accessing your new WordPress site

Now that we have everything deployed you need to access the WordPress site and do the initial install of the application itself. You will need to navigate to the load balancers section the cluster. Then select wordpress load balancer under the services section.

lbs

Now we will need to find the IP address in order to access the site. From within the Load Balancer section you will find that information.

ip

Now take the cluster IP open it within a new browser window on port 80. In my example the address looks like this:

http://138.197.237.216:80

If everything was done correctly you will be presented with the WordPress login screen and you are good to go!

install

There is still some leg work to be done to make this site your own. You will need to point the DNS to your domain but that can be saved for a later post. This post was only intended to be a simple guide to get started, and not take a technical deep dive on WordPress management. You can expect some follow up posts addressing things like persistent volumes, scaling, and cluster management as a whole that will be technical in nature. Until then feel free to sign up for free and give it a try yourself today!

Show Comments

Get the latest posts delivered right to your inbox.