Container to mount a GCS bucket and serve it using nginx
872
This is a simple docker container that allows you to connect to a GCS bucket and serve webpages from it, in Kubernetes.
See the Quick Start with supplied Terraform and Kubernetes Manifests
Warning You should really consider using workload identity
plutov/gcs-k8f-deployment-full.yml
Upload what ever static site you want in to the root of the bucket.
All pages will get rendered when you hit the link.
The server supports sub-pages, so if you are uploading everything in go gs://gcs-webstite/site/index.html - Your page will
be available at http://<>/site/index.html
| Name of endpoint | Response code | Example response |
|---|---|---|
/healthz | http/200 | {"status":"UP"} |
/health | http/200 | {"status":"UP"} |
Note These endpoints do not generate logs, to save costs.
To make use of your own custom 404 page, place a 404.html file in the root of the bucket/
This page will be served for the below errors:
Currently not supported. If this is required please open an issue.
| IP Stack version | IP address | Port |
|---|---|---|
v6 | [::] | 80 |
v4 | 0.0.0.0 | 80 |
docker build -t gcs-web-server:latest .
apiVersion: apps/v1
kind: Deployment
metadata:
name: gcs-website
spec:
replicas: 2
strategy:
type: Recreate
selector:
matchLabels:
app.kubernetes.io/name: gcs-website
template:
metadata:
labels:
app.kubernetes.io/name: gcs-website
spec:
volumes:
- name: gcs
emptyDir: {}
serviceAccountName: gcs-website
containers:
- name: gcs-website
image: "userbradley/gcs-web-server"
imagePullPolicy: IfNotPresent
ports:
- containerPort: 80
protocol: TCP
livenessProbe:
httpGet:
path: /healthz
port: 80
initialDelaySeconds: 10
periodSeconds: 10
securityContext:
privileged: true
capabilities:
add:
- SYS_ADMIN
volumeMounts:
- mountPath: /var/www/site
name: gcs
lifecycle:
postStart:
exec:
command: [ "gcsfuse","--implicit-dirs", "-o", "allow_other", "gcs-bucket-name", "/var/www/site" ]
preStop:
exec:
command: [ "fusermount", "-u", "/var/www/site/" ]
Content type
Image
Digest
sha256:c54fbf052…
Size
21.5 MB
Last updated
over 3 years ago
docker pull userbradley/gcs-web-server