Recently I had to solve a problem where we needed to serve a web page from GCS.
You've probably come here from googling something like:
- How to mount a GCS bucket to a docker container
- How to mount a GCS bucket to a pod
- How to serve a gcs bucket in nginx
I know the Hard core Google cloud engineers among us are screaming
This is why: You cant attach Cloud IAP to it.
We have a number of GKE clusters I manage, so the easiest solution was below:
- Mount buckets as file mounts in linux
- whack nginx in front of it
- create a load balancer and enable IAP
I put together a repo for you, that has terraform and Kubernetes manifests in to get you up and running
The idea behind this is that you are equipped with all the tools needed in a docker container to run the web server.
All you have to do is put the
html files you want to serve, in the GCS bucket anywhere, and then the container will serve them.
If you have any issues with this, please don't hesitate to get in contact with me, or open an issue on GitHub