OpenLume
ExamplesFor dev tools
Sign in
← Kubernetes YAML Visualizer

Kubernetes Service not reaching Pods: selector doesn’t match labels

If a Service times out or kubectl get endpoints shows none, the most common cause is that its selector doesn’t match the labels on your Pods. Kubernetes reports no error, because a Service with zero matching Pods is valid.

In this manifest the Service selects app=web while the Pods are labelled app=web-frontend. The traffic check marks the broken hop. Change either value in the editor so they agree and the link turns green. Paste your own manifest to check it the same way.

100% in your browser·No upload·No LLM·Works offline
Loading…

Will traffic reach the Pods?

  • Service web:80 does not reach Deployment web-frontend. The selector doesn't match Deployment "web-frontend": the Service wants app=web, the Pods have app=web-frontend. The Service has no Pods to send traffic to. Fix: Make the Service's spec.selector and the Pod template's labels identical.

What this manifest does

This manifest defines 2 resources in the default namespace: the main thing it runs is 1 Deployment. Let’s walk through it.

Deployment web-frontend runs 2 Pods, running myorg/web-frontend:1.4.2.

Things to know before using it

  • No Pod in this manifest matches this Service’s selectorService web

    This Service selects pods with app=web, but no workload in this manifest has matching pod labels. That’s fine if the matching Deployment lives in another file — but if you expected to see them connected here, double-check the labels. Fix: Confirm a Deployment / StatefulSet exists with spec.template.metadata.labels matching every key in the Service’s spec.selector.

  • No topology spread or anti-affinityDeployment web-frontend

    Deployment "web-frontend" has 2 replicas but no spread rules. All Pods could land on one node, a single failure domain. Fix: Add topologySpreadConstraints or podAntiAffinity to spread across zones/nodes.

The full manifest

# The Service looks for app=web. The Pods are labelled app=web-frontend.
apiVersion: v1
kind: Service
metadata:
  name: web
spec:
  selector:
    app: web
  ports:
    - port: 80
      targetPort: 3000
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: web-frontend
spec:
  replicas: 2
  selector:
    matchLabels:
      app: web-frontend
  template:
    metadata:
      labels:
        app: web-frontend
    spec:
      containers:
        - name: web-frontend
          image: myorg/web-frontend:1.4.2
          ports:
            - containerPort: 3000
          resources:
            requests:
              cpu: 100m
              memory: 128Mi
            limits:
              cpu: 500m
              memory: 256Mi
          securityContext:
            runAsNonRoot: true
            allowPrivilegeEscalation: false
            readOnlyRootFilesystem: true
            capabilities:
              drop: ["ALL"]
          readinessProbe:
            httpGet:
              path: /ready
              port: 3000
          livenessProbe:
            httpGet:
              path: /healthz
              port: 3000

Related examples

  • targetPort doesn’t match the container port
  • Deployment + Service
  • Ingress backend port not exposed

Stuck on a Kubernetes concept?

Ask anything and get a narrated visual lesson, pitched at your level. Free.

Personalize your lesson

Choose what works for you, or keep the recommended settings.

Optional lesson settings

Try an example

OpenLume
Narrated visual lessons on any tech topic.
Products
  • OpenLume
  • Finance exams
  • For developer tool startups
Tools
  • Kubernetes YAML Visualizer
  • GitHub Actions Visualizer
  • Dockerfile Visualizer
Roadmaps
  • All roadmaps
  • DevOps / Platform Engineer
  • Frontend Developer
  • Backend Developer
  • Full-Stack Developer
Resources
  • How it works?
  • FAQs
Company
  • Contact us
  • Privacy Policy
  • Terms of Use

Copyright © 2026 OpenLume. All rights reserved.