Skip to main content

Services and Storage Clinic

Retrieval Prompts

  1. State the four guarantees of the Kubernetes pod network model.
  2. Name the four Service types and what each gives you.
  3. State the difference between port, targetPort, and nodePort.
  4. Explain what an EndpointSlice is and who populates it.
  5. State the difference between ReadWriteOnce, ReadOnlyMany, and ReadWriteMany.

Compare and Distinguish

Separate:

  • ClusterIP versus headless Service
  • Ingress versus Gateway API
  • Volume versus PersistentVolume versus PersistentVolumeClaim
  • StatefulSet versus Deployment
  • emptyDir versus configMap volume versus PVC-backed volume

Common Mistake Check

For each, identify the error:

  1. "My Service has no endpoints because the selector is wrong." (Is that always the reason?)
  2. "I'll just use Ingress; I don't need to install anything."
  3. "ReadWriteOnce means one Pod at a time can mount the volume."
  4. "Deleting a PVC deletes the disk."
  5. "A StatefulSet gives me automatic database failover."

Mini Application

East-west: Service + DNS

Apply the Deployment from Workshop 02 and a ClusterIP Service:

apiVersion: v1
kind: Service
metadata: { name: web }
spec:
selector: { app: web }
ports:
- { name: http, port: 80, targetPort: 80 }

From a debug pod (kubectl run -it --rm debug --image=nicolaka/netshoot -- bash):

dig +short web.default.svc.cluster.local
curl -v http://web

Break the readiness probe intentionally (set path: /definitely-not-here). Verify that kubectl get endpointslices -l kubernetes.io/service-name=web goes empty and curl begins to fail. Restore and verify recovery.

North-south: Ingress

Install the NGINX ingress controller. Add a second Deployment api. Write one Ingress that routes / -> web and /api -> api. Verify both paths via port-forward.

Draw the path

Produce a hand-drawn or ASCII diagram for the full path external client -> LB -> node -> ingress controller Pod -> Service -> Pod -> container. Label who is responsible for each hop.

Stateful: PVC + StatefulSet

Deploy a three-replica Postgres StatefulSet with a headless Service as in Concept 12. Verify:

kubectl get sts,pvc,pv,svc
dig +short db-1.db.default.svc.cluster.local

Delete db-1. Confirm the new Pod has the same name, the same DNS, and the same PVC.

Evidence Check

This page is complete only if you can produce, from memory, a working Deployment + Service + Ingress configuration and a StatefulSet + headless Service + PVC configuration, and trace the packet path for a request into each.