Interview Prep/Real-World Interview/Write-a-Kubernetes-manifest tasks

Write an Ingress that routes `/api` to the api service and `/` to the web service with TLS.

IntermediateHands-onWrite-a-Kubernetes-manifest tasks
Answer
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: app
  annotations:
    cert-manager.io/cluster-issuer: letsencrypt-prod
spec:
  ingressClassName: nginx
  tls:
    - hosts: [app.example.com]
      secretName: app-tls
  rules:
    - host: app.example.com
      http:
        paths:
          - path: /api
            pathType: Prefix
            backend:
              service: { name: api, port: { number: 8080 } }
          - path: /
            pathType: Prefix
            backend:
              service: { name: web, port: { number: 80 } }

Key trick → pathType is required in networking.k8s.io/v1, and ingressClassName picks the controller. cert-manager fills the app-tls Secret automatically through the annotation.

All Real-World Interview questions Roadmap: Interview readiness

More on Write-a-Kubernetes-manifest tasks