Hello,

     I have installed master and worker nodes but when started the pods the worker node could not resolve Postgres run on the master node. Do you have any ideas? 

error message log worker pod
psql: error: could not translate host name “postgres” to address: Name or service not known

master and worker it same subnet on VM, I just updated kube to the latest version, but it still happens.

Cluster information:

Kubernetes version: 1.29.2
Installation method:
Host OS: RHEL 8.10
CNI and version:
cat /etc/cni/net.d/10-flannel.conflist
{
“name”: “cbr0”,
“cniVersion”: “0.3.1”,
“plugins”: [
{
“type”: “flannel”,
“delegate”: {
“hairpinMode”: true,
“isDefaultGateway”: true
}
},
{
“type”: “portmap”,
“capabilities”: {
“portMappings”: true
}
}
]
}

CRI and version: crio do not install

docker --version
Docker version 26.0.0, build 2ae903e

kubectl get nodes
NAME STATUS ROLES AGE VERSION
node-401 Ready control-plane 23h v1.29.2
node-402 Ready 143m v1.29.2

CoreDNS v1.11.1

Hi,
Can you please explain what do you mean by

Are you trying to resolve postgres entry from the worker node itself?

Sorry, the master node started can resolve the postgres hostname, but the worker node found the error

pods details below.

NAMESPACE NAME READY STATUS RESTARTS AGE IP NODE
alpha alpha-init-85lrm 0/1 Completed 0 107m 192.168.0.155 dr-node-kube-401
alpha alpha-postgres-744b858b8b-qjrvm 1/1 Running 0 109m 192.168.0.147 dr-node-kube-401
alpha alpha-primary-74c44bf774-bwzkj 1/1 Running 0 107m 192.168.0.156 dr-node-kube-401
alpha alpha-secondary-79f86b8fb6-xsm8w 0/1 Running 0 13m 192.168.1.91 dr-node-kube-402
kube-flannel kube-flannel-ds-dmv6s 1/1 Running 2 (3h12m ago) 23h 10.89.149.36 dr-node-kube-401
kube-flannel kube-flannel-ds-tf2hm 1/1 Running 1 (155m ago) 163m 10.89.149.37 dr-node-kube-402
kube-system coredns-84745cdc89-284pz 1/1 Running 0 15m 192.168.0.158 dr-node-kube-401
kube-system coredns-84745cdc89-976md 1/1 Running 0 15m 192.168.0.157 dr-node-kube-401
kube-system etcd-dr-node-kube-401 1/1 Running 2 (3h12m ago) 23h 10.89.149.36 dr-node-kube-401
kube-system kube-apiserver-dr-node-kube-401 1/1 Running 2 (3h12m ago) 23h 10.89.149.36 dr-node-kube-401
kube-system kube-controller-manager-dr-node-kube-401 1/1 Running 2 (3h12m ago) 23h 10.89.149.36 dr-node-kube-401
kube-system kube-proxy-7x9m4 1/1 Running 2 (3h12m ago) 23h 10.89.149.36 dr-node-kube-401
kube-system kube-proxy-kfvkz 1/1 Running 1 (155m ago) 163m 10.89.149.37 dr-node-kube-402
kube-system kube-scheduler-dr-node-kube-401 1/1 Running 2 (3h12m ago) 23h 10.89.149.36 dr-node-kube-401

postgres is one pod`s hostname instead of one service, in the previous kubernetes version, is it ok to resolve the hostname?
in my understanding, the offical method to access the pods is by the headless service.

I just re-install kube to 1.26.3 1.27.3 1.31.x it still happens

postgres it is okay to resolve hostname if run on host-A or host-B.

If Postgres run host-A, the app on host-B cannot resolve the hostname.

If Postgres run host-B, the app on host-A cannot resolve the hostname.

I suspect a connection between host A and B, but the server is allowed to use all ports. Firewall and iptables are not enabled.