Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Running cloudsql-proxy as Kubernetes DaemonSet #49
I'd like to run the cloudsql-proxy container as a DaemonSet instead of a sidecar in my pods, because I have multiple (different) pods on a node, which all need to connect to a Cloud SQL instance. So instead of:
So the other pods can just mount the hostPath
However, when I try to start the cloudsql-proxy container, it gives me this error:
According to the Kubernetes docs, when using
One solution would be using TCP sockets, but I prefer UNIX sockets.
May I ask why you prefer UNIX sockets over TCP sockets?
Here is how I would have done that:
Then, simply connect to the SQL proxy of your choice:
You end-up with only one pod/sqlproxy running in the cluster on one node (doesn't matter which), and of course this kind of service is not accessible from the outside. You can scale the sqlproxy by increasing the number of replicas.
On the other hand, if you absolutely want to use UNIX sockets and the DaemonSet, then this documentation shows you how to run the container in a privileged mode: http://kubernetes.io/docs/user-guide/security-context/. I'll try to get the documentation of HostPath updated to point to this URL.