Deploying WordPress and MySQL to GKE

30 minutes
  • 4 Learning Objectives

About this Hands-on Lab

In this lab, we will create a reasonably complex application stack on Google Kubernetes Engine, creating deployments for WordPress and MySQL, utilizing persistent disks. To complete this lab, you should have some basic experience and familiarity with Google Cloud Platform and Google Kubernetes Engine.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Create the GKE Cluster and Storage Class
  1. Create a three-node GKE cluster using the n1-standard-1 instance type.
  2. Create a new storage class object to utilize SSD persistent disks. You can use the ssd-storageclass.yaml file in the supporting Git repo.
Create Persistent Volumes

Create persistent volume claims for MySQL and WordPress. You can use the mysql-pvc.yaml and wordpress-pvc.yaml files in the supporting git repo.

Deploy MySQL
  1. Create a Secret object called mysql to store the MySQL DB root password. If you are using the mysql-secret.yaml file in the GitHub repo, you should change the value of the password for security reasons. You will need to base64 encode a new value.
  2. Create the MySQL deployment. You can use the mysql-deployment.yaml file in the GitHub repo.
  3. Create the MySQL service. You can use the mysql-service.yaml file in the GitHub repo.

    echo -n mypassword | base64 -w 0
Deploy WordPress
  1. Create the WordPress deployment. You can use the wordpress-deployment.yaml file in the GitHub repo.
  2. Create the WordPress service. You can use the wordpress-service.yaml file in the GitHub repo.

It will take a few minutes for the GCP load balancer to assign a public IP address, after which you should be able to access the WordPress site by following the link from the Services & Ingress tab in the GKE section of the GCP console.

You should then be able to access your new installation.

Note: WordPress installations can be insecure, and you should not leave yours running for long before concluding and stopping this lab.

Additional Resources

Log in to Google Cloud Platform by right-clicking Open Google Console and selecting the option to open it in a new private browser window (this option will read differently depending on your browser — e.g., in Chrome, it says "Open Link in Incognito Window"). Then, sign in using the credentials provided on the lab page.

On the Welcome to your new account screen, review the text, and click Accept. In the "Welcome Cloud Student!" pop-up once you're signed in, check to agree to the terms of service, choose your country of residence, and click Agree and Continue.

Supporting files for this lab can be found in this Git repo: https://github.com/linuxacademy/content-gke-basics

For a more challenging version of this lab, try writing the required YAML yourself by referring to the public GKE and Kubernetes documentation. You can always use the files in the repo if you get stuck.

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Get Started
Who’s going to be learning?

How many seats do you need?

  • $499 USD per seat per year
  • Billed Annually
  • Renews in 12 months

Ready to accelerate learning?

For over 25 licenses, a member of our sales team will walk you through a custom tailored solution for your business.


$2,495.00

Checkout
Sign In
Welcome Back!
Thanks for reaching out!

You’ll hear from us shortly. In the meantime, why not check out what our customers have to say about ACG?