Mongodb error code 127

{“t”:{“$date”:“2023-08-01T10:55:20.250+00:00”},“s”:“W”, “c”:“NETWORK”, “id”:21207, “ctx”:“conn9”,“msg”:“getaddrinfo() failed”,“attr”:{“host”:“mongodb-percona-cfg-1.mongodb-percona-cfg.psmdb.svc.cluster.local”,“error”:“Name o
r service not known”}}

There is an option to customize you kubernetes cluster domain name:

clusterServiceDNSSuffix: svc.cluster.local

MongoDB requires a fully qualified domain names saved in certificates and in replica config.
For the clusters powered by coredns you can use the command:

kubectl get cm coredns -n kube-system -o jsonpath="{.data.Corefile}"

Alternatively check resolv.conf from any kubernetes pods: