liveBook · Manning

Kubernetes DNS endpoint

As explained in Road to Kubernetes

A Kubernetes DNS endpoint is a DNS name that identifies a Kubernetes Service or other resource within the cluster DNS domain.

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

How Road to Kubernetes covers it

How deep it goes
Explains the DNS format and demonstrates database connectivity, but stops short of detailing DNS implementation internals.
Examples
Uses postgres-svc, a PostgreSQL database Pod, kubectl exec, and the psql client.
What it assumes
Assumes a running Pod, a PostgreSQL database Service, and familiarity with opening a Pod shell.
What you can do after
Operate in-cluster connectivity by constructing a Service DNS endpoint and using it from a Pod.
How it connects
Connects Kubernetes Services, Pods, namespaces, Cluster IPs, and PostgreSQL clients.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Road to Kubernetes. The section links point to the parts of the book it draws on.