Appearance

DNS and service exposure

Separate in-cluster names, virtual addresses, node entry points, and provider load balancers.

What you will understand

  • Resolve namespace-aware Service names
  • Distinguish ClusterIP, NodePort, and LoadBalancer reachability
  • Explain local-cluster exposure limitations without assuming a cloud provider

Builds on: Services and EndpointSlices

Mental model: a name is not an exposure rule

Cluster DNS gives Services stable names so clients can avoid hard-coding allocated IP addresses. A normal Service named catalog in namespace training has a DNS name shaped like catalog.training.svc.cluster.local when the cluster domain is cluster.local. That domain is configurable; inspect your cluster rather than assuming every cluster uses it. A normal ClusterIP Service’s address records resolve to its virtual IP, not directly to every Pod address. Headless Services use different discovery semantics and appear later.

A client Pod’s resolver configuration usually includes namespace-aware search domains. The short name catalog naturally looks in the caller’s namespace. catalog.training makes the intended namespace explicit, and the full service name identifies the complete domain. A Pod in another namespace should not assume the same short name reaches the same application. DNS can resolve a Service even when it has no ready backends; naming and backend health are distinct boundaries.

Service DNS is normally intended for cluster workloads. Your laptop’s resolver does not automatically know the cluster’s private DNS zone or route to its ClusterIP range. A name that resolves inside a Pod may fail outside the cluster without indicating a cluster DNS fault. First establish where the caller runs.

A short name depends on the caller namespace

Resolve a normal ClusterIP Service name through Pod resolver search domains.

Flow viewStep 1 of 3
The caller uses a short nameA Pod in training queries catalog. Its resolver search domains include training.svc.cluster.local.. Client Pod in training, active. Pod resolver search list, active. Cluster DNS, readyClient Pod in training
Client Pod in trainingIn focus
Pod resolver search list
Pod resolver search listIn focus
Cluster DNS
Cluster DNSReady
Client Pod in trainingIn focus
Pod resolver search listIn focus
Cluster DNSReady
Animation controls
Speed
0.5×
1×
2×
Explore a scenario
Normal behavior
Failure: short name looks in another namespace
The caller uses a short name

A Pod in training queries catalog. Its resolver search domains include training.svc.cluster.local.

Read the complete visual sequence
  1. The caller uses a short name

    A Pod in training queries catalog. Its resolver search domains include training.svc.cluster.local.

  2. DNS returns the Service frontend

    For a normal ClusterIP Service, the answer contains the Service virtual IP. DNS has not tested the backend HTTP application.

  3. Connection follows resolution

    The client separately connects to the returned IP and Service port. Endpoint readiness and forwarding now determine the usable backend path.

Failure: short name looks in another namespace

Failure: short name looks in another namespace

  1. Move only the caller

    The client now runs in test but catalog still exists in training. The short name is unchanged.

  2. The search path changes the question

    catalog expands toward catalog.test.svc.cluster.local. It can fail or resolve a different Service in test.

  3. Address the intended namespace

    Use catalog.training or the verified full Service domain. The name should encode the scope the application actually intends.

About this model

The diagram uses the common cluster.local domain for illustration; the actual cluster domain is configurable.

Walkthrough: inspect the caller’s resolver

Use the existing service-demo workload from the previous lesson, in the same dedicated namespace. The following long-running debug Pod supplies tools for repeated tests. BusyBox is a training image; use an approved equivalent where image policies require one.

kubectl run discovery-client --image=busybox:1.36.1 --restart=Never \
  --command -- sleep 3600
kubectl wait --for=condition=Ready pod/discovery-client --timeout=90s
kubectl exec discovery-client -- cat /etc/resolv.conf
kubectl exec discovery-client -- nslookup service-demo
kubectl exec discovery-client -- wget -qO- http://service-demo:8080/

Expect the short name to resolve when the client and Service share a namespace and cluster DNS is working. Use kubectl get service service-demo to compare the returned address with the allocated ClusterIP. A successful lookup followed by failed HTTP requests shifts the investigation toward ports, endpoints, network policy, forwarding, or the application rather than proving DNS is the only suspect.

Choose the external entry point

ClusterIP exposes a virtual frontend within the cluster network. NodePort adds a port on eligible node addresses, using the implementation’s Service forwarding to reach backends. Clients need network reachability to a node address and permission through relevant firewalls. A NodePort on a containerized local-cluster node may be inside a VM or container network, so “localhost plus nodePort” is not universally reachable from the host.

LoadBalancer asks a configured implementation to provision or integrate an external load-balancing frontend. It usually builds on NodePort behavior, although implementations can route directly to Pods and support configurations that avoid allocating node ports. Cloud providers or installed local/bare-metal controllers supply the implementation. The Service API type alone cannot create a public load balancer on an arbitrary laptop.

Internal and external frontends have different owners

Compare ClusterIP, NodePort, and provider-backed LoadBalancer access.

Flow viewStep 1 of 3
ClusterIP serves internal clientsA cluster workload can use the Service virtual IP when the network implementation supports that path. A laptop does not automatically have that route.. In-cluster caller, active. ClusterIP:8080, ready. Backend Pod:80, readyIn-cluster caller
In-cluster callerIn focus
ClusterIP:8080
ClusterIP:8080Ready
Backend Pod:80
Backend Pod:80Ready
In-cluster callerIn focus
ClusterIP:8080Ready
Backend Pod:80Ready
Animation controls
Speed
0.5×
1×
2×
Explore a scenario
Normal behavior
Failure: no LoadBalancer implementation is installed
ClusterIP serves internal clients

A cluster workload can use the Service virtual IP when the network implementation supports that path. A laptop does not automatically have that route.

Read the complete visual sequence
  1. ClusterIP serves internal clients

    A cluster workload can use the Service virtual IP when the network implementation supports that path. A laptop does not automatically have that route.

  2. NodePort adds a node entry point

    An external caller needs a reachable node address and allocated node port. Network rules and local VM/container boundaries still apply.

  3. LoadBalancer requires an implementation

    A provider/controller provisions an external frontend and connects it to a supported backend path. Creating the Service object alone is not provisioning software.

Failure: no LoadBalancer implementation is installed

Failure: no LoadBalancer implementation is installed

  1. The Service request is accepted

    A local cluster accepts type LoadBalancer as valid API configuration. Internal Service fields can still be allocated.

  2. External provisioning never occurs

    No compatible controller provisions an external address. The internal workload can remain healthy while the external address is pending.

  3. Use the environment’s supported access path

    Install/configure the appropriate implementation through a deliberate platform setup, or use a local debugging tunnel for the exercise.

About this model

A common LoadBalancer-to-NodePort path is shown; implementations may instead target Pods directly.

apiVersion: v1
kind: Service
metadata:
  name: node-entry-demo
spec:
  type: NodePort
  selector:
    app: service-demo # Existing web Pods from the prior lesson.
  ports:
    - name: http
      port: 8080
      targetPort: http
      # Omit nodePort: the API allocates from its configured range.
kubectl apply -f node-entry-demo.yaml
kubectl get service node-entry-demo
kubectl get nodes -o wide
# A debugging tunnel to a selected backend, without external provisioning:
kubectl port-forward service/service-demo 8080:8080

For Service port-forward, kubectl selects a matching Pod and forwards to its target port. It does not test the ordinary ClusterIP forwarding path or every replica, and the session depends on that selected Pod. Stop the tunnel when finished. A LoadBalancer frontend being pending in an environment without a controller is expected missing infrastructure, not proof that nginx cannot listen.

Practice and pitfalls

For each access method, write the caller location, destination name or IP, client-facing port, and final Pod listener. Keep TLS and application authorization separate from raw reachability: a TCP Service does not automatically terminate HTTPS, issue certificates, or authenticate users. NodePort and LoadBalancer exposure also require deliberate network and security configuration. Do not expose a training workload to an untrusted network merely to make a request test convenient.

Check your understanding

A LoadBalancer Service stays pending on a local cluster while in-cluster HTTP succeeds. What does that evidence suggest?

The Pod, internal Service path, and tested DNS lookup can be healthy while external load-balancer provisioning is unavailable. Inspect whether the local environment supplies a compatible controller and external network integration. Use the documented local access method or a temporary port-forward for the exercise; restarting healthy Pods will not install a load-balancer implementation.

Practice caller-aware DNS and exposure inspection in the module lab. Next, combine these boundaries into a repeatable debugging workflow.

Primary documentation

Go to the source

Reviewed 2026-10-27 · Kubernetes 1.37 · Related local exercise

Search the book

Search loads when you open it.