CloudSQL proxy on GKE with Workload identity example
This repo is a sample of how to use Workload identity with GKE CloudSQL proxy, you will learn how to deploy a Workload Identity enabled cluster, deploy a CloudSQL proxy that uses a KSA (kubernetes Service Account) to authenticate to a the CloudSQL API via a proxy and Workload Identity
NB: the commands below have been performed on a Linux system, MacOS should work the same way, i havent's tried this from a Windows computer, if you are a Windows user, maybe you can try using the Cloud Shell
You will need gcloud and kubectl to be installed
Start by exporting your project ID as an environment variable
export PROJECT_ID=xxxxx
Authenticate on Set you default compute region and zone
gcloud config compute/region europe-west4
gcloud config compute/zone europe-west4-a
Create a Cluster with 3 nodes and workload identity enabled
Create a MYSQL CloudSQL Instance, this command will create a MYSQL 5.7 instance with 1vCPU and 3.75GB of memory in europe-west4-a. Replace PASSWORD with a secure password, this is the root password for the DB.
Now you are ready to deploy wordpress, start by creating a secret containing the db username and password (Replace PASSWORD with the password used when creating the CloudSQL instance