A Kubernetes DNS endpoint gives a Pod a predictable name for reaching a Service inside the cluster, avoiding dependence on a dynamically assigned Cluster IP. section 8.4.3
Build the endpoint from the resource’s DNS components:
- Use the format <resource-name>.<namespace>.<resource-type>.cluster.local. section 8.4.3
- For a PostgreSQL Service named postgres-svc, use its DNS endpoint from inside another Pod instead of repeatedly checking its Cluster IP. section 8.4.3
Connect from a Pod
Enter a Pod with kubectl exec, install the psql client, and connect to the PostgreSQL database through postgres-svc using the Kubernetes DNS endpoint. section 8.4.3
