Prompt

How do I handle service discovery between Kubernetes microservices?

Technology / Cloud Infrastructure1 observationLast seen Oct 19, 2026

Latest observation

Oct 19, 2026OpenAI APIWeb search: off

In Kubernetes, service discovery is usually handled for you by Kubernetes Services plus DNS. For most microservices, the simplest pattern is:

1) Put each microservice behind a Kubernetes Service

Create a Service object for each app you want to reach.

Example:

apiVersion: v1
kind: Service
metadata:
  name: orders
spec:
  selector:
    app: orders
  ports:
    - port: 80
      targetPort: 8080

Then other pods can reach it by DNS name:

  • orders
  • orders.default
  • orders.default.svc.cluster.local (full FQDN)

If your client and service are in different namespaces, use:

orders.my-namespace.svc.cluster.local

2) Use Kubernetes DNS, not hardcoded IPs

Pods get DNS resolution through CoreDNS automatically. This means you should reference services by name, not pod IPs.

Good:

  • http://orders:80
  • http://orders.my-namespace.svc.cluster.local

Avoid:

  • storing pod IPs
  • hardcoding node addresses
  • calling individual pods directly unless you specifically need that

3) Choose the right Service type

For internal microservice-to-microservice communication, use:

  • ClusterIP: internal-only, most common
  • Headless Service (clusterIP: None): if you need direct pod DNS records, stateful workloads, or custom client-side load balancing

Example headless service:

apiVersion: v1
kind: Service
metadata:
  name: kafka
spec:
  clusterIP: None
  selector:
    app: kafka
  ports:
    - port: 9092

4) Consider readiness probes

Kubernetes will only send traffic to pods that are Ready. This is important for service discovery because it prevents routing to unhealthy instances.

Add:

  • readinessProbe
  • livenessProbe

5) Use labels carefully

Services select pods via labels. Make sure your labels are stable and specific enough.

Example:

selector:
  app: orders

If labels are wrong, service discovery breaks because the Service won’t find any endpoints.

6) For external access, use Ingress or Gateway API

If another service is outside the cluster or you need HTTP routing from outside Kubernetes:

  • use Ingress
  • or better, Gateway API if available in your environment

But for internal microservices, stick with Services + DNS.

7) Handle retries and timeouts in clients

Service discovery solves “how do I find the service,” but not reliability. Your client should also:

  • set timeouts
  • retry safely
  • use exponential backoff
  • implement circuit breakers if needed

8) If you need advanced discovery, use a service mesh

For traffic management, observability, mTLS, and more advanced discovery patterns, consider:

  • Istio
  • Linkerd
  • Consul service mesh

These are useful when you need more than native Kubernetes DNS/service discovery.


Practical recommendation

For most Kubernetes setups:

  1. Create a ClusterIP Service for each microservice
  2. Call it by DNS name
  3. Add readiness probes
  4. Avoid hardcoded IPs
  5. Use a service mesh only if you need advanced features

If you want, I can show:

  • a full example with two microservices
  • cross-namespace discovery
  • or headless service vs ClusterIP differences.

Observation history

How did Obsurfable measure this prompt?

Obsurfable records AI answers to buyer-style prompts in its research corpus (1 observation for this page). Metrics are distributions over observations, not a single static ranking.

Which AI systems does Obsurfable collect answers from?

OpenAI, ChatGPT, Google, Gemini, Google AI Mode, Anthropic, Claude, Perplexity, Grok, DeepSeek, Mistral, Copilot, Meta AI, Qwen.

How can brands improve their AEO?

Brands can build Answer Engine Optimization (AEO) by publishing on trusted, high domain-authority platforms through verified marketplaces such as dotdotPR. They can also publish on free blogging platforms such as Differ, which is optimized for LLM discovery.

Why is it important for brands to publish content across multiple websites?

Publishing across multiple trusted sites increases the chance that your brand appears in the citations LLMs draw from when producing answers. Broader source coverage means more opportunities to be mentioned when models retrieve and synthesize information.

Want this interpreted for your brand?

Explorer is the free public corpus. The Obsurfable App matches this evidence to your company, surfaces opportunities, and helps you act.