18 / 25 · Service boundaries
Service discovery
Service discovery maps a stable service name to current usable destinations. Instances change as they deploy, fail or scale. Discovery finds candidates; routing and health policies decide how requests reach them.
What you will practise
- Resolve a stable name
- distinguish discovery and routing
- handle stale endpoints
Before you start: Service name, endpoint and readiness.
About 4 minutes · offline-generated English female narration · captions included. Diagrams are conceptual; timings are illustrative.
Download MP4CaptionsListen without the video
Download audioChapters and full transcript
Let us understand service discovery. A school directory lists which rooms currently host each club. Students ask for the chess club rather than memorizing an old room number. The directory can become stale, so someone must update it and decide what happens when a listed room is closed. Service discovery maps a stable service name to current usable destinations. Instances change as they deploy, fail or scale. Discovery finds candidates; routing and health policies decide how requests reach them.
Follow the normal path. The caller requests the payment capability by service name instead of storing an individual pod address that may disappear during the next deployment. The platform or registry tracks service destinations and readiness. Registration and removal need reliable ownership and observable convergence. SeatSpot booking replicas should find the payment service even when its pod addresses change. Hard-coded ephemeral IPs become stale during routine operations.
Now change one condition. Client or server routing selects a usable endpoint. Discovery and load balancing cooperate, but they describe different responsibilities. A common misunderstanding is this: Finding an endpoint authorizes access to it. Discovery provides destinations, not identity or business permissions. Think about this. DNS resolves the payment service. Does that prove every connection will succeed? Pause the video and make your prediction. No. Name resolution can succeed while endpoints are unhealthy, changing or unreachable. Timeouts and failure handling still apply.
Let us reason with a concrete example. Three payment pods are replaced during a rolling deployment. Their individual IPs may change while a Kubernetes Service name remains stable. Endpoint/readiness propagation and existing connections still create a transition interval. Use the platform service abstraction and test replacement with live requests. Do not promise instantaneous convergence from a stable name. These figures are teaching examples, not production guarantees.
Turn the idea into a design decision. An old instance becomes unready and a replacement joins. Cached addresses and existing connections can outlive the registry update. A failed connection may use a safe bounded retry against current membership. Do not hide repeated errors with unlimited retries. When you try the practice task, look for this result. Stable naming helps callers, but does not imply instantaneous endpoint convergence.
Check your understanding. Knowing an address does not authorize a request. Validate the relevant identity, transport security and resource permissions at the appropriate boundaries. Here is a challenge. DNS resolves the service but requests fail. What do you check next? Pause before the answer. Check ready endpoints, target port, network reachability/policy, TLS identity and the dependency itself. Compare resolution with an actual bounded request and inspect traces. For an interview, compare client-side selection with a stable service/proxy address. Say what you would measure, not only which tool you would buy.
Start with an everyday picture
A school directory lists which rooms currently host each club. Students ask for the chess club rather than memorizing an old room number. The directory can become stale, so someone must update it and decide what happens when a listed room is closed.
Why SeatSpot needs this
SeatSpot booking replicas should find the payment service even when its pod addresses change. Hard-coded ephemeral IPs become stale during routine operations.
Trace one step at a time
Move through the diagram at your pace. Teal paths are active; unavailable components are labelled.
Ask for a stable name
The caller requests the payment capability by service name instead of storing an individual pod address that may disappear during the next deployment.
Read all six mechanism steps
Ask for a stable name
The caller requests the payment capability by service name instead of storing an individual pod address that may disappear during the next deployment.
Maintain endpoints
The platform or registry tracks service destinations and readiness. Registration and removal need reliable ownership and observable convergence.
Choose a destination
Client or server routing selects a usable endpoint. Discovery and load balancing cooperate, but they describe different responsibilities.
Replace an instance
An old instance becomes unready and a replacement joins. Cached addresses and existing connections can outlive the registry update.
Retry within a budget
A failed connection may use a safe bounded retry against current membership. Do not hide repeated errors with unlimited retries.
Verify service identity
Knowing an address does not authorize a request. Validate the relevant identity, transport security and resource permissions at the appropriate boundaries.
Pause and make a prediction
DNS resolves the payment service. Does that prove every connection will succeed?
Correct a common misunderstanding
Claim to question: Finding an endpoint authorizes access to it.
Better explanation: Discovery provides destinations, not identity or business permissions.
Follow a rolling endpoint replacement
- Write a stable service name and three changing instance addresses.
- Replace one instance and mark propagation/readiness delay.
- Trace an existing connection and a newly resolved connection separately.
Check what you can explain
This is your self-check, not an automated grade. Try again without the diagram tomorrow.
0 of 3 goals checked. Choose one remaining idea to practise next.
Teach it back
Without looking, explain what this component changes, what it does not solve and what happens if it fails. Use the animation to check your explanation, then switch to Engineering.
Engineering model and trade-offs
Discovery can be DNS-based, registry-based or platform-provided. Client-side discovery chooses an instance in the caller; server-side discovery can expose a stable proxy/service address. Clarify which layer owns selection.
Registration, readiness, deregistration and stale caches affect routing. Name resolution can succeed while a returned endpoint is unusable. DNS TTL and connection reuse influence how quickly callers observe changes.
Secure the registry and service identity. Discoverability is not authorization. Timeouts, bounded retries and observability remain necessary when a resolved instance fails.
Work through an example
Three payment pods are replaced during a rolling deployment.
Reason with the numbers
Their individual IPs may change while a Kubernetes Service name remains stable. Endpoint/readiness propagation and existing connections still create a transition interval.
Make a decision
Use the platform service abstraction and test replacement with live requests. Do not promise instantaneous convergence from a stable name.
Implementation sketch
http://payments.default.svc.cluster.local:8080
# Example Kubernetes Service DNS name inside a configured cluster.
# Deployment/pod addresses may change behind the service.This is a private cluster naming example, not an internet URL or a working endpoint supplied by Sukoaa. Service definition, namespace and network policy must exist.
Where this is used
- Dynamic replica sets and container platforms.
- Locating current service endpoints without hard-coded pod IPs.
Common mistakes
- Treating discovery as authentication.
- Caching endpoint addresses forever.
- Ignoring readiness and stale connections.
Practise a reasoned answer
Answer aloud or write notes before opening the reference. These prompts teach reasoning and trade-offs; they are not claimed questions from a particular company.
Discovery versus load balancing?
Choose a practice depth
- Foundation
- Explain a stable name with changing instances.
- Practical
- Compare client-side selection with a stable service/proxy address.
- Advanced
- Discuss stale caches, connection reuse, registry security and convergence evidence.
Self-check rubric
- State the required user outcome and the relevant invariant.
- Explain the normal path and one failure path.
- Name a cost or consistency/latency trade-off.
- Say what you would measure or test before trusting it.
For deeper practice, connect this topic to the previous lesson and identify a shared bottleneck. A longer answer is not automatically a better answer.
Try it before viewing the solution
DNS resolves the service but requests fail. What do you check next?
Check one key idea
Your explanation and interview notes
Saved only in this browser when storage is available. Export a backup from the course page before clearing browser data or moving devices.
Loading your local notes…
Official references and next reading
The explanation, fictional examples and animations are original teaching material. Vendor behavior depends on the specific product/version; use its documentation before deploying.