Google Cloud Platform’s Config Connector exposes Google Cloud Platform resources as Kubernetes objects. In this tutorial, we will use Config Connector deployed locally on Minikube to provision and manage a Cloud SQL database instance in GCP.

Assuming you have Minikube up and running, and the Google Cloud SDK installed and configured, the very first step is to create a secret based on the GCP service account with the owner role.

The below commands creates a GCP service account and binds to the owner role.

Let’s download the JSON key associated with the service account to the development machine and register it as a secret in Minikube in the cnrm-system namespace.

Let’s download the Config Connector YAML files to install it in Minikube. This results in a set of Custom Resource Definitions (CRD) deployed in Kubernetes.

We can check all the CRDs deployed in Minikube by Config Connector.A pod is also deployed in the cnrm-system namespace. Before we create Cloud SQL instance, let’s make sure that the Cloud SQL and Cloud SQL Admin APIs are enabled in our GCP account:

The Config Connector expects a Kubernetes namespace that matches GCP project id. This is a mandatory requirement that we need to follow.

Since we want to create a Cloud SQL instance, let’s take a closer look at the CRD.

The output has been snipped for brevity.

Read More:   Give Developers an Advantage with Advanced Events and Data Monitoring – InApps Technology 2022

Create the below YAML file to provision a GCP Cloud SQL DB Instance based on MySQL in us-central region.

This results in the creation of the Cloud SQL instance which can be verified with gcloud CLI. You can also access this resource from kubectl.

If you are curious, use kubectl describe command to take a closer look at the SQLInstance object.

Wait for the DB instance to become ready. You can now create a DB user to access the instance. The user definition is also submitted to the CRD as a YAML file.

If you have MySQL client installed on your local machine, you can access the Cloud SQL shell.

Finally, you can terminate the Cloud SQL instance by deleting the SQLInstance and SQLUser objects running in Minikube.

Config Connector from Google is an indication of how Kubernetes is becoming the universal control plane to manage the resource lifecycle.

Read More:   Interactive Application Security Testing Is the Next Big Thing in AppSec – InApps Technology 2022

Janakiram MSV’s Webinar series, “Machine Intelligence and Modern Infrastructure (MI2)” offers informative and insightful sessions covering cutting-edge technologies. Sign up for the upcoming MI2 webinar at