【发布时间】:2020-11-24 10:49:35
【问题描述】:
目前我正在使用云代理连接到 Postgres Cloud SQL 数据库作为 sidecar。然而,在使用 Istio 时,它引入了自己的 sidecar,导致 Pod 中有两个代理。所以我想,加密连接不也可以使用 Istio 建立吗?
基本上,it is possible to connect to an external IP using Istio。
It should also be possible to configure a DestinationRule which configures TLS.
And it also be possible to create Client certificates for Cloud SQL.
编辑:可能是同样的问题:NGINX TLS termination for PostgreSQL
所以我最终得到了类似的东西
apiVersion: networking.istio.io/v1beta1
kind: ServiceEntry
metadata:
name: external-db
spec:
hosts:
- external-db
ports:
- number: 5432
name: postgres
protocol: TLS
location: MESH_EXTERNAL
resolution: STATIC
---
apiVersion: networking.istio.io/v1beta1
kind: DestinationRule
metadata:
name: external-db
spec:
host: external-db
trafficPolicy:
tls:
mode: MUTUAL
clientCertificate: /etc/certs/client-cert.pem
privateKey: /etc/certs/client-key.pem
caCertificates: /etc/certs/server-ca.pem
---
apiVersion: v1
kind: Service
metadata:
name: external-db
spec:
clusterIP: None
ports:
- protocol: TCP
port: 5432
---
apiVersion: v1
kind: Endpoints
metadata:
name: external-db
subsets:
- addresses:
- ip: 10.171.48.3
ports:
- port: 5432
在豆荚里
sidecar.istio.io/userVolumeMount: '[{"name":"cert", "mountPath":"/etc/certs", "readonly":true}]'
sidecar.istio.io/userVolume: '[{"name":"cert", "secret":{"secretName":"cert"}}]'
但是,服务器拒绝连接。所以问题是,这个设置可能工作吗?它甚至有任何意义吗?
【问题讨论】:
-
嗨@user140547 这似乎是一个非常具体的配置问题,理论上一切都应该有效。出于这个原因,我建议您联系Google's Support,以便他们可以更深入地调查可能影响您的实例的因素。
-
@gso_gabriel 同时,我发现了这篇文章:postgresql.org/message-id/… 因此,如果不考虑应用程序级协议,也许不可能简单地代理它,尽管这是关于复制的。跨度>
标签: postgresql kubernetes google-cloud-sql istio cloud-sql-proxy