OpenLume
ExamplesFor dev tools
Sign in
← Kubernetes YAML Visualizer

Kubernetes Ingress 503: backend port doesn’t match the Service

An Ingress backend names a Service and a port. That port must be one the Service exposes under ports.port. It is easy to write the container’s port there instead, and the result is usually a 503 from the ingress controller.

Here the Ingress sends traffic to port 8080, but the Service exposes 80 and forwards to 8080 itself. The traffic check marks the hop. Change the Ingress port number to 80 in the editor and the path connects.

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

Will traffic reach the Pods?

  • Ingress api.example.com/ does not reach Service api. This Ingress sends traffic to port 8080 of Service "api", but the Service only exposes 80. Fix: Point the Ingress backend at a port the Service exposes.

What this manifest does

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

Deployment api runs 2 Pods, running myorg/api:1.4.2.

A Service (api) gives these Pods a stable cluster-internal address. Public traffic enters through an Ingress (api) at api.example.com.

Things to know before using it

  • No topology spread or anti-affinityDeployment api

    Deployment "api" 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 Ingress sends traffic to port 8080. The Service only exposes port 80.
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: api
spec:
  ingressClassName: nginx
  tls:
    - hosts: [api.example.com]
      secretName: api-tls
  rules:
    - host: api.example.com
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: api
                port:
                  number: 8080
---
apiVersion: v1
kind: Service
metadata:
  name: api
spec:
  selector:
    app: api
  ports:
    - port: 80
      targetPort: 8080
---
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: myorg/api:1.4.2
          ports:
            - containerPort: 8080
          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: 8080
          livenessProbe:
            httpGet:
              path: /healthz
              port: 8080

Related examples

  • Ingress and Service in different namespaces
  • targetPort doesn’t match the container port
  • Ingress → Service → Deployment

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.