Deployment, Service, Ingress

Put the three core objects together to run and expose an app end to end on EKS.

A typical web app on EKS uses three objects that build on each other:

  1. Deployment — runs and self-heals a set of identical pods.
  2. Service — gives those pods one stable in-cluster address and load-balances across them.
  3. Ingress — exposes the service to the outside world through an ALB.

The flow of a request

Internet → ALB (Ingress) → Service → Pods. The Deployment keeps the pods running; the Service finds them by label; the Ingress routes external traffic in.

Apply all three from one manifest and you have a complete, externally reachable app.

Example

Example · yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: web
spec:
  replicas: 3
  selector:
    matchLabels:
      app: web
  template:
    metadata:
      labels:
        app: web
    spec:
      containers:
        - name: web
          image: 111122223333.dkr.ecr.us-east-1.amazonaws.com/web:1.0
          ports:
            - containerPort: 8080
---
apiVersion: v1
kind: Service
metadata:
  name: web
spec:
  selector:
    app: web
  ports:
    - port: 80
      targetPort: 8080

When to use it

  • A backend team deploys an API Deployment, a ClusterIP Service, and an ALB Ingress together to make their service reachable from the internet end to end.
  • A platform team uses a single manifest file containing all three objects to keep the Deployment, Service, and Ingress definitions co-located in Git.
  • A staging environment runs the same Deployment/Service/Ingress trio as production but with a different Ingress hostname, enabling identical infrastructure across envs.

More examples

Deployment object for EKS

A three-replica Deployment pulling an ECR image, the foundation of the Deployment-Service-Ingress pattern.

Example · yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: api
spec:
  replicas: 3
  selector:
    matchLabels:
      app: api
  template:
    metadata:
      labels:
        app: api
    spec:
      containers:
      - name: api
        image: 123456789.dkr.ecr.us-east-1.amazonaws.com/api:v1.0
        ports:
        - containerPort: 8080

Service exposing the Deployment

A ClusterIP Service that load-balances traffic across all pods labeled app=api, providing a stable DNS name within the cluster.

Example · yaml
apiVersion: v1
kind: Service
metadata:
  name: api-svc
spec:
  selector:
    app: api
  ports:
  - protocol: TCP
    port: 80
    targetPort: 8080

Ingress routing to the Service

An ALB Ingress that creates a public load balancer routing external traffic for api.example.com to the api-svc Service.

Example · yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: api-ingress
  annotations:
    kubernetes.io/ingress.class: alb
    alb.ingress.kubernetes.io/scheme: internet-facing
    alb.ingress.kubernetes.io/target-type: ip
spec:
  rules:
  - host: api.example.com
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: api-svc
            port:
              number: 80

Discussion

  • Be the first to comment on this lesson.