You can do this with MiniKube for development and testing, or Google Cloud's GKE for the real thing.
# Make sure you have MiniKube installed and it's the latest
brew update
minikube delete || echo "You don't have MiniKube installed yet."
brew cask reinstall minikube
# Start it up
minikube start --memory=4096 --cpus=2
# Grab a hostname from ngrok with forwarding to MiniKube
ngrok http $(minikube ip):80kubectl create serviceaccount --namespace kube-system tiller
kubectl create clusterrolebinding tiller-binding --clusterrole=cluster-admin --serviceaccount kube-system:tiller
helm init --service-account tiller --wait --upgradeexport CERT_ISSUER="letsencrypt-staging" # this can also be letsencrypt-prod
helm install stable/nginx-ingress --namespace kube-system --name ingress --set rbac.create=true
helm install stable/cert-manager --name cert --wait --set ingressShim.extraArgs=\{--default-issuer-name=${CERT_ISSUER},--default-issuer-kind=ClusterIssuer\}# Before running this you should replace instances of "[email protected]" with your own email
kubectl apply -f cert-issuers.yaml
# Before running this you should replace instances of
# 1. "foobar" with your own app name
# 2. "foo.example.com" with your own hostname or the the ngrok hostname if you're using that
kubectl apply -f app-deployment.yamlFirst notice that a request to the HTTP endpoint will result in a redirect to the HTTPS version.
$ curl -v 64c3c5b3.ngrok.io
* Rebuilt URL to: 64c3c5b3.ngrok.io/
...
< Location: https://64c3c5b3.ngrok.io/
<
<html>
<head><title>308 Permanent Redirect</title></head>
<body bgcolor="white">
<center><h1>308 Permanent Redirect</h1></center>
<hr><center>nginx/1.13.12</center>
</body>
</html>
* Connection #0 to host 64c3c5b3.ngrok.io left intactThen try the same thing but using curl -L so that we follow the redirect.
$ curl -L 64c3c5b3.ngrok.io
...
<title>Hello World</title>
...And similarly if you hit the HTTPS endpoint directly.
$ curl https://64c3c5b3.ngrok.io
...
<title>Hello World</title>
...