Whitelist traffic to mysql from a kubernetes service

8/14/2018

I have a Cloud MySQL instance which allows traffic only from whitelisted IPs. How do I determine which IP I need to add to the ruleset to allow traffic from my Kubernetes service?

-- Artem Mikhalitsin
google-cloud-platform
google-cloud-sql
kubernetes

2 Answers

8/14/2018

I am using Google Cloud Platform, so my solution was to add the Google Compute Engine VM instance External IP to the whitelist.

-- Artem Mikhalitsin
Source: StackOverflow

8/14/2018

The best solution is to use the Cloud SQL Proxy in a sidecar pattern. This adds an additional container into the pod with your application that allows for traffic to be passed to Cloud SQL.

You can find instructions for setting it up here. (It says it's for GKE, but the principles are the same)

If you prefer something a little more hands on, this codelab will walk you through taking an app from local to on a Kubernetes Cluster.

-- kurtisvg
Source: StackOverflow