【发布时间】:2021-02-02 06:59:36
【问题描述】:
我开始使用服务网格 istio 在 Kubernetes 上构建 Postgresql Ha 集群。在我在命名空间中启用 istion 注入之前,我在没有 istio 的情况下尝试了它。它运作良好。启用 istio 注入后,statefulset 中的第二个 pod 无法通过无头服务连接到集群中的第一个 pod。
postgreslq-test-postgresql-ha-pgpool-779d7f588-qmbmf 1/1 Running 9 69m
postgreslq-test-postgresql-ha-postgresql-0 3/3 Running 0 10m
postgreslq-test-postgresql-ha-postgresql-1 2/3 Running 6 9m50s
我删除了在 helm install 下创建的网络策略。
kubectl logs postgreslq-test-postgresql-ha-postgresql-1 postgresql
postgresql-repmgr 13:00:54.29 DEBUG ==> Host 'postgreslq-test-postgresql-ha-postgresql-0.postgreslq-test-postgresql-ha-postgresql-headless.gitlab-test.svc.cluster.local:5432' is not accessible
psql: error: could not connect to server: server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
为了自己测试,我用 postgresql-client 创建了一个 pod
root@testpod:/# psql -h postgreslq-test-postgresql-ha-postgresql-0.postgreslq-test-postgresql-ha-postgresql-headless.gitlab-test.svc.cluster.local -U posgres
psql: server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
Istio 代理日志:
"response_flags": "UF,URX",
"start_time": "2020-10-19T14:21:44.631Z",
"method": "-",
"request_id": "-",
"upstream_host": "10.93.202.188:5432",
"x_forwarded_for": "-",
"requested_server_name": "-",
"bytes_received": "0",
"istio_policy_status": "-",
"bytes_sent": "0",
"upstream_cluster": "outbound|5432||postgresql-ha-postgresql-headless.gitlab-prod.svc.cluster.local",
"downstream_remote_address": "10.93.203.197:42222",
"authority": "-",
"path": "-",
"protocol": "-",
"upstream_service_time": "-",
"upstream_local_address": "-",
"duration": "3",
"upstream_transport_failure_reason": "-",
"route_name": "-",
"downstream_local_address": "10.93.202.188:5432",
"user_agent": "-",
"response_code": "0"
Kubernetes 版本:k8s.gcr.io/hyperkube:v1.18.4
Istio 版本:1.6.3
Helm 图表:bitnami/postgresql-ha CHART VERSION:5.0.0 APP VERSION:11.9.1
我认为某种 Istio 配置会导致问题,因为它可以在没有 Istio 的情况下工作。
知道哪里出了问题吗?
【问题讨论】:
-
有很多应用程序与 istio 不兼容。如果有修复或解决方法,请查看此问题和链接的 postgres 问题:github.com/istio/istio/issues/14743
标签: postgresql kubernetes istio bitnami