简体   繁体   English

Kubernetes Postgres Pod 无法访问

[英]Kubernetes Postgres Pod not reachable

I have a K8s Cluster with couple of pods.我有一个带有几个 pod 的 K8s 集群。 I have a postgres pod of type Deployment which simply runs a "postgres:12" image我有一个部署类型的 postgres pod,它只运行一个“postgres:12”图像

docker pull postgres:12

the pod is named "metadatadb" pod 被命名为“metadatadb”

there are other pods of type Cronjob that are dependent on it.还有其他依赖于它的 Cronjob 类型的 pod。 from time to time I see some of these cronjob instances failing with the below error我不时看到其中一些 cronjob 实例失败并出现以下错误

ERROR [08001] could not translate host name "metadatadb" to address: Name or service not known错误 [08001] 无法将主机名“metadatadb”转换为地址:名称或服务未知

This error happens rarely (which means in most of the times the cronjob runs and connects successfully).此错误很少发生(这意味着在大多数情况下 cronjob 运行并成功连接)。 I can't figure out why.我不知道为什么。

Thank you谢谢

The error is the result of a missing Service or a problem with the Cluster DNS.该错误是由于缺少Service或集群 DNS 问题造成的。

Background: A pod does not get a DNS entry, if you want to connect to a pod you need the internal IP of it.背景:Pod 没有 DNS 条目,如果要连接到 Pod,则需要它的内部 IP。 To create DNS names (and internal load balancing with a service ip) you need to create a service.要创建 DNS 名称(以及使用服务 ip 进行内部负载平衡),您需要创建一个服务。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 将 Kubernetes Postgres pod 连接到存储在持久卷上的现有数据库 - Connect Kubernetes Postgres pod to existing database stored on persistent volume Kubernetes Pod 无法使用 Hasura 映像连接到本地 postgres 服务器 - Kubernetes Pod can't connect to local postgres server with Hasura image 通过 psql 执行某些命令时,端口转发到 postgres kubernetes pod 失败并重置连接 - Port forward to postgres kubernetes pod fails with connection reset when executing certain commands via psql 无法通过 bash 脚本向 kubernetes 中的 postgres pod 发出长 sql 查询 - Unable to issue long sql query to postgres pod in kubernetes via bash script Rest Api应用程序无法连接到同一Kubernetes Pod中的postgres db - Rest Api application can't connect to postgres db in the same Kubernetes pod [Postgres复制]远程主机无法访问repmgr解决 - [Postgres Replication]Remote host is not reachable repmgr salve 在 kubernetes 的多容器 pod 环境中启动第一个容器 postgres 数据库后,如何将 keycloak 作为第二个容器运行? - How to run a keycloak as second container after first container postgres Database start up at multi-container pod environment of kubernetes? JupyterHub pod 不再连接到 Postgres pod - JupyterHub pod no longer connects to Postgres pod Pgpool 无法在 kubernetes 作为 pod 启动 - Pgpool fails to start on kubernetes as a pod Kubernetes postgres PVC 数据 - Kubernetes postgres PVC data
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM