WordPress Kubernetes

WordPress is an Open Source software designed for everyone, emphasizing accessibility, performance, security, and ease of use to create a website, blog, or app. WordPress is a content managment system (CMS) built on PHP and using MySQL as a data store, powering over 30% of internet sites today.

This DigitalOcean Marketplace Kubernetes 1-Click installs WordPress and MariaDB onto your Kubernetes cluster via Helm Charts. This 1-Click makes use of a DigitalOcean LoadBalancer with Kubernetes Ingress so you can view your WordPress site at a public URL. To help manage your data two DigitalOcean Volumes are used with Kubernetes Persistent Volumes for the WordPress and MariaDB services.

Thank you to all the contributors whose hard work make WordPress valuable for users.

Notes:

  • This stack requires a minimum configuration of 2 Nodes at the $10/month plan (2GB memory / 1 vCPU).
  • The WordPress 1-Click App also includes a $1/month block storage for both WordPress and MariaDB.
  • The Wordpress 1-Click app also includes a $12/month DigitalOcean Load Balancer to ensure that ingress traffic is distributed across all of the nodes in your DOKS cluster.

Software Included

Package Version License
WordPress 6.4.2 GPLv2
MariaDB 11.2.2 GPLv2

Creating an App using the Control Panel

Click the Deploy to DigitalOcean button to install a Kubernetes 1-Click Application. If you aren’t logged in, this link will prompt you to log in with your DigitalOcean account.

Deploy to DO

Creating an App using the API

In addition to creating WordPress Kubernetes using the control panel, you can also use the DigitalOcean API. As an example, to create a 3 node DigitalOcean Kubernetes cluster made up of Basic Droplets in the SFO2 region, you can use the following doctl command. You need to authenticate with doctl with your API access token) and replace the $CLUSTER_NAME variable with the chosen name for your cluster in the command below.

doctl kubernetes clusters create --size s-4vcpu-8gb $CLUSTER_NAME --1-clicks wordpress-kubernetes

Getting Started After Deploying WordPress Kubernetes

How to Connect to Your Cluster

As you get started with Kubernetes on DigitalOcean be sure to check out how to connect to your cluster using kubectl and doctl:

https://www.digitalocean.com/docs/kubernetes/how-to/connect-to-cluster/

Additional instructions for configuring the DigitalOcean Kubernetes:

How to confirm that WordPress is running

First, check if the Helm installation was successful, by running below command:

helm ls -n wordpress

The output looks similar to (notice that the STATUS column value is deployed):

NAME      NAMESPACE REVISION UPDATED                              STATUS   CHART             APP VERSION
wordpress-kubernetes wordpress 1        2022-03-10 14:56:39.419223 +0200 EET deployed wordpress-19.0.4 6.4.2

Next, verify if the WordPress and MariaDB Pods are up and running:

kubectl get pods --all-namespaces -l app.kubernetes.io/instance=wordpress-kubernetes

The output looks similar to (all Pods should be in a READY state, and STATUS should be Running):

NAMESPACE   NAME                         READY   STATUS    RESTARTS   AGE
wordpress   wordpress-kubernetes-5784c7bbfb-h7n9h   1/1     Running   0          12m
wordpress   wordpress-kubernetes-mariadb-0          1/1     Running   0          12m

Next, inspect the external IP address of your WordPress Load Balancer by running below command:

kubectl get svc -n wordpress

The output looks similar to (look for the EXTERNAL-IP column, containing a valid IP address):

NAME                TYPE           CLUSTER-IP      EXTERNAL-IP      PORT(S)                      AGE
wordpress           LoadBalancer   10.245.59.107   143.244.213.33   80:32589/TCP,443:32044/TCP   14m
wordpress-mariadb   ClusterIP      10.245.42.121   <none>           3306/TCP                     14m

Finally, WordPress stack should now be successfully installed and running

Connect to WordPress

First, get the WordPress URL by using below command:

kubectl get svc -n wordpress wordpress-kubernetes

The output looks similar to (notice the EXTERNAL-IP column value for the wordpress service):

NAME        TYPE           CLUSTER-IP      EXTERNAL-IP      PORT(S)                      AGE
wordpress-kubernetes   LoadBalancer   10.245.59.107   143.244.213.33   80:32589/TCP,443:32044/TCP   46m

Extract WordPress URL

export WORDPRESS_IP=$(kubectl get svc -n wordpress wordpress-kubernetes -o jsonpath='{.status.loadBalancer.ingress[*].ip}')
echo "WordPress URL: http://$WORDPRESS_IP/"
echo "WordPress Admin URL: http://$WORDPRESS_IP/admin"

Next, extract the credentials to see admin your WordPress site:

kubectl get secret --namespace wordpress wordpress-kubernetes -o jsonpath="{.data.wordpress-password}" | base64 --decode

Finally, open a web browser and navigate to the WordPress admin panel using the http://$WORDPRESS_IP/admin address and login with the admin user and the password you got from the kubernetes secret above.

Checkout the WordPress docs for more info on using WordPress.

Note:

Once this chart is deployed, it is not possible to change the application’s access credentials, such as usernames or passwords, using Helm. To change these application credentials after deployment, delete any persistent volumes (PVs) used by the chart and re-deploy it, or use the application’s built-in administrative tools if available.

Tweaking Helm Values

The WordPress stack provides some custom values to start with. Please have a look at the values file from the main GitHub repository (explanations are provided inside, where necessary).

You can always inspect all the available options, as well as the default values for the WordPress Helm chart by running below command:

helm show values bitnami/wordpress --version 19.0.4

After tweaking the Helm values file (values.yml) according to your needs, you can always apply the changes via helm upgrade command, as shown below:

helm upgrade wordpress-kubernetes bitnami/wordpress --version 19.0.4\
  --namespace wordpress \
  --values values.yml

Upgrading the WordPress Chart

You can check what versions are available to upgrade, by navigating to the emissary-ingress official releases page from GitHub. Alternatively, you can also use ArtifactHUB, which provides a more rich and user friendly interface.