Prompt

How do I make services discover each other in Kubernetes?

Technology / Cloud Infrastructure1 observationLast seen Oct 19, 2026

Latest observation

Oct 19, 2026OpenAI APIWeb search: off

In Kubernetes, the usual way for services to discover each other is through Kubernetes DNS + Services.

The standard pattern

  1. Create a Service for each set of Pods you want to reach.
  2. Kubernetes gives that Service a stable DNS name.
  3. Other Pods can call it by name instead of hardcoding IPs.

Example

If you create a Service named api in the default namespace, other Pods can reach it as:

  • http://api
  • or fully qualified: http://api.default.svc.cluster.local

If it’s in another namespace, use:

  • http://api.other-namespace.svc.cluster.local

What makes this work

  • Service: provides a stable virtual IP and load-balancing to matching Pods.
  • CoreDNS: resolves the Service name to the Service IP.
  • Labels/selectors: the Service routes traffic to the right Pods.

Typical setup

Deployment

apiVersion: apps/v1
kind: Deployment
metadata:
  name: api
spec:
  replicas: 2
  selector:
    matchLabels:
      app: api
  template:
    metadata:
      labels:
        app: api
    spec:
      containers:
      - name: api
        image: my-api:latest
        ports:
        - containerPort: 8080

Service

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

Now other Pods can use:

curl http://api

When to use which Service type

  • ClusterIP (default): internal service discovery inside the cluster
  • NodePort: expose service on each node
  • LoadBalancer: expose externally via cloud load balancer
  • Headless Service (clusterIP: None): direct Pod DNS records, useful for StatefulSets

Headless Service example

Useful when clients need to discover individual Pods rather than a single load-balanced endpoint.

apiVersion: v1
kind: Service
metadata:
  name: db
spec:
  clusterIP: None
  selector:
    app: db
  ports:
  - port: 5432

Then DNS can return Pod IPs directly.

Key things to check if discovery fails

  • The Service selector matches Pod labels
  • CoreDNS is running
  • DNS is enabled in the Pod
  • Network policies aren’t blocking traffic
  • The app is using the correct Service name/namespace

If you want, I can also show:

  • how DNS names are formed in Kubernetes,
  • how to do discovery across namespaces,
  • or how StatefulSets use headless services.

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.