External name from pod

k8s-blog

#1

Hello.
I have external postgres. And i have to connect to postgres by name(kube-postgres). But i can’t connect to kube-postgres by name. I can connect by ip. I tried to use labels, annotations for example:

kubectl label pods labelex kube-postgres=148.253.123.124

Then i go to my labelex pod and did

ping kube-postgres

Ping was answered ping: unknown host
Help me, please


#2

Hace you read about services? Please do. That is the answer, the docs explain in detail