WordPress on Kubernetes in Google Cloud for beginners

WordPress on Kubernetes in Google Cloud for beginners

In this video you will see step-by-step how to deploy a WordPress instance on K8s cluster. I decided not to use any tutorial, or ‘existing yaml file’. Instead, I’m going to build my YAML definitions from scratch, using only examples from official kubernetes.io docs.

WordPress is a stateful application and requires both: file storage to store html, config, templates etc., and database.
In this particular approach I will use:
– Google Cloud SQL for MySQL instance
– PersistentVolumeClaim with Google Cloud Persistent Disk for file storage.

Before this video starts, I already prepared:
1) Kubernetes cluster, using Google Kubernetes Engine. If you need help with that step, check out my quickstart:

2) CloudSQL instance to use that as my MySQL instance. Creating an instance is really simple, couple of clicks. You can also check the official google cloud quickstart for that:

In 2:44 I’m referring to this video: (I explain in that one how to create persistent storage and show you that on example).

Even though I haven’t published my YAML definitions, if you want to see an example of such deployment, you can check out a similar one in official kubernetes.io tutorial:

The YAML definition:

PS. This is my second version of that video. In previous one (“hidden”) I followed one of the tutorials, but I decided it would be a more valuable to show you how to create such “long-and-scary” YAML definition by yourself, using both “dry-run” option and examples from official docs.

Hope you like it 🙂

4 thoughts on “WordPress on Kubernetes in Google Cloud for beginners

  1. Hi, congrats for this tutorial. I have one problem with the database connection. I get this error: 'Error establishing a database connection'. I have a public IP for cloud SQL, I can connect using console, but it doesn't seem to work with Kubernetes env. Any ideas?

  2. 1:20,note.txt
    3:40,kubectl apply -f wordpress/
    3:48,kubectl get pvc
    4:35,kubectl create deployment wordpress –image wordpress –dry-run=client -o yaml
    7:20,kubectl create secret generic dev-db-secret –from-literal=username=wp-user –from-literal=password=changeme –from-literal=address=

Leave a Reply

Your email address will not be published. Required fields are marked *