apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: first
spec:
  ingressClassName: nginx
  rules:
    - host: "example.com"
      http:
        paths:
          - backend:
              service:
                name: frontend
                port:
                  number: 80
            path: /
            pathType: Prefix
    - host: "api.example.com"
      http:
        paths:
          - backend:
              service:
                name: api
                port:
                  number: 80
            path: /
            pathType: Prefix