Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Instead of using URLs to make different applications accessible, some Ingress resource use sub-domains. So if you have an application configured this way, your .yaml file would look like below: instead of having one host and multiple path, now we have multiple host, where each host represents a sub-domain and the single path redirects the request to the service. For a secure connection, a certificate, and therefore a secret, is required for each host, following the procedure already seen in Configuring TLS certificate.

Code Block
languageyml
titlecafe-ingress.yaml (sub-domain)
collapsetrue
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: <name>
  namespace: <namespace>
spec:
  tls:
  - hosts:
    - <subdomain1>.<host>
    secretName: <secret1>
  - hosts:
    - <subdomain2>.<host>
    secretName: <secret2>
  rules:
  - host: <subdomain1>.<host>
    http:
      paths:
      - path: /
        backend:
          serviceName: <service1>
          servicePort: <port1>
  - host: <subdomain2>.<host>
    http:
      paths:
      - path: /
        backend:
          serviceName: <service2>
          servicePort: <port2>

...