Or by using kubectl, and I prefer the later because it's more convenient. So lets create a tls secret.
➜ kubectl create secret tls simple-tls --cert=tls.crt --key=tls.key
secret/simple-tls created
As usual check it using kubectl get command.
➜ kubectl get secret
NAME TYPE DATA AGE
postgres-secret Opaque 2 42h
simple-tls kubernetes.io/tls 2 7s
Setup Ingress TLS
Now that we already have our tls secret ready. We can update the previous ingress definition to use the TLS secret we just created. Add the following tls configuration inside the spec section.
As you can see above the request is being redirected to https which is port 443.
Now lets try to curl using https to port 443. This time we add -k or --insecure to allow insecure connection because we are using self-signed certificate. If not we will get failed to verify certificate error.