Ingress for external access

ClusterIP keeps the service private. Ingress is how you let real users in. It is a routing layer that terminates HTTP, picks a backend Service by host or path, and forwards the request.

k8s/ingress.yaml
yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: enterprise-rag
  labels:
    app: enterprise-rag
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /
spec:
  ingressClassName: nginx
  rules:
    - host: enterprise-rag.local
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: enterprise-rag
                port:
                  number: 80

ingressClassName: nginx picks the nginx controller if you have more than one installed. For production, add TLS via cert-manager and lock the host to your real domain.

Request path from user to pod

How traffic flows through Ingress, Service, and pod to reach your FastAPI router.

Quiz: Quiz

Loading practice…