# This file serves as an example for configuring ingresses using the nginx ingress controller and
# tls certificates issued by letsencrypt and managed via cert manager
#
# adjust domain settings and apply via:
# kubectl -n dev1 apply -f tls_ingress_example.yml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  annotations:
    # add an annotation indicating the issuer to use.
    cert-manager.io/cluster-issuer: letsencrypt
    kubernetes.io/tls-acme: "true"
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/ssl-redirect: 'true'
  name: nginx-example-ingress
spec:
  rules:
  - host: nginx-example.dev1.example.com
    http:
      paths:
      - pathType: Prefix
        path: /
        backend:
          service:
            name: nginx-example
            port:
              number: 80
  tls: # < placing a host in the TLS config will determine what ends up in the cert's subjectAltNames
  - hosts:
    - nginx-example.dev1.example.com
    secretName: nginx-example-cert # < cert-manager will store the created certificate in this secret.