In this tutorial, we will deploy a MySQL database on Google Kubernetes Engine (GKE) using Helm and load data in the database. Before you start this tutorial, make sure you have installed ROBIN Storage on GKE.
Continuing on the ROBIN installation tutorial, let us install the MySQL client as the first step so that we can use MySQL once deployed. Run the following command in the cloud shell.
Deploy MySQL Database on GKE using Helm
Let us create a MySQL database using Helm and ROBIN Storage. In the Cloud Shell run the following command. This command will install MySQL in Master/Slave configuration mode. We are setting the storageClass to robin-0-3 to benefit from data management capabilities ROBIN Storage brings.
Before proceeding, let’s make sure all necessary workloads (pods) are running properly. Click on the “Workloads” tab on the left hand panel, and wait for the status of all workloads to be shown as ”OK” with a green check next to them.
Let’s confirm that our Database is deployed and all relevant Kubernetes resources are ready.
You should now see the following output showing the status of your MySQL database.
Now get the Service IP address of our MySQL database.
Get Password of our MySQL database from Kubernetes Secret
Adding data to the MySQL database
We’ll use movie data to load data into our MySQL database. Let’s create a table named “movies”.
Let’s add 9 movies to the “movies” table.
To see the movies added to the “movies” table, run the following command.
You should see an output similar to the following:
We have now deployed a MySQL database on GKE with a table and some sample data.
To benefit from data management capabilities ROBIN brings, such as taking snapshots, making clones, and creating backups, we have to register this MySQL Helm release as an application with ROBIN.
Registering the MySQL Helm release as an application
Registering this MySQL Helm release as an application will enable ROBIN map and track all resources associated with the Helm release for this MySQL database. To register the Helm release as an application, run the following command.
Let us verify ROBIN is now tracking our MySQL Helm release as a single entity (app).
You should see an output similar to this.
We have successfully registered our Helm release as an app called “myfilms”.
This concludes the Deploy MySQL on GKE tutorial. Now that we have deployed the MySQL database, loaded data, and registered the MySQL Helm release with ROBIN, we can create a MySQL database snapshot and create a MySQL clone including app plus data.