Edw*_*ung 7 google-cloud-sql google-kubernetes-engine
我有一个类似于这个github问题的问题.
但是,我可以使用守护进程而不是服务来代替使用服务吗?我们的想法是与同一节点上的所有pod共享同一个套接字.它是否会遇到与同一问题的答案中提到的相同的安全问题.我问,因为边车容器的方法阻止我产生更多的豆荚.实际上,我有不同类型的服务在Cloud SQL上使用相同的数据库.每个pod都必须为代理保留一些CPU和内存,这对我来说听起来多余.
Yes you can do this. However, the pod for the daemonset will no longer listen on localhost. So you must configure both the cloud_sql_proxy and database connection to use the hostIP of the Node.
You must set your cloud_sql_proxy
to listen on 0.0.0.0
- command:
- /cloud_sql_proxy
- -instances=project:region:db=tcp:0.0.0.0:5432
- -credential_file=/secrets/cloudsql/credentials.json
Run Code Online (Sandbox Code Playgroud)
You must also change your database connection to use the hostIP
env:
- name: DB_HOST
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: status.hostIP
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
775 次 |
最近记录: |