Skip to content

Instantly share code, notes, and snippets.

@zone117x
Last active September 1, 2020 14:03
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zone117x/05f048f640a24a6edd21a042bd3e19ed to your computer and use it in GitHub Desktop.
Save zone117x/05f048f640a24a6edd21a042bd3e19ed to your computer and use it in GitHub Desktop.
KubeSail template for deploying a free-tier Gaia Hub with disk-based storage
# Gaia hub & reader container deployment controller
apiVersion: apps/v1
kind: Deployment
metadata:
name: gaia-app
spec:
selector:
matchLabels:
app: gaia-app
replicas: 1
template:
metadata:
labels:
app: gaia-app
spec:
containers:
- name: gaia-hub
image: zone117x/gaia-hub
imagePullPolicy: Always
env:
- name: GAIA_PORT
value: "4000"
- name: GAIA_DRIVER
value: "disk"
- name: GAIA_DISK_STORAGE_ROOT_DIR
value: "/data"
- name: GAIA_SERVER_NAME
value: "$KUBESAIL_INGRESS_DOMAIN"
- name: GAIA_READ_URL
# NOTE: this is dynamic and based on your namespace & cluster you are assigned to
# KubeSail will replace template variables $KUBESAIL_NAMESPACE and $KUBESAIL_INGRESS_DOMAIN
# before rendering / applying the template, so for example:
# "reader.$KUBESAIL_INGRESS_DOMAIN" will become
# "reader.USER.CLUSTER.kubesail.io"
value: "https://reader.$KUBESAIL_INGRESS_DOMAIN/"
- name: NODE_ENV
value: "production"
resources:
requests:
cpu: '5m'
memory: '32Mi'
limits:
cpu: '100m'
memory: '64Mi'
ports:
- containerPort: 4000
volumeMounts:
- mountPath: /data
name: gaia-data
- name: gaia-reader
image: zone117x/gaia-reader
imagePullPolicy: Always
env:
- name: GAIA_DISK_STORAGE_ROOT_DIR
value: "/data"
- name: NODE_ENV
value: "production"
resources:
requests:
cpu: '5m'
memory: '32Mi'
limits:
cpu: '100m'
memory: '64Mi'
ports:
# Default port used by the gaia-reader (no env config available yet).
- containerPort: 8008
volumeMounts:
- mountPath: /data
name: gaia-data
volumes:
- name: gaia-data
persistentVolumeClaim:
claimName: gaia-pvc
---
# Storage -- https://kubesail.com/blog/storage-on-kubernetes
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: gaia-pvc
labels:
app: gaia-app
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
# By default KubeSail gives you 100Mi of SSD
storage: 100Mi
---
# Network service
apiVersion: v1
kind: Service
metadata:
name: gaia-svc
spec:
ports:
- name: gaia-svc-hub
protocol: TCP
port: 4000
targetPort: 4000
- name: gaia-svc-reader
protocol: TCP
port: 8008
targetPort: 8008
selector:
app: gaia-app
type: ClusterIP
---
# Web / SSL
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
# Note: this ends up being the sub-domain name (e.g. hub.{user}.c1.kubesail.io)
name: hub
spec:
rules:
- hosts:
- "hub.$KUBESAIL_INGRESS_DOMAIN"
http:
paths:
- backend:
serviceName: gaia-svc
servicePort: 4000
---
# Web / SSL
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
# Note: this ends up being the sub-domain name (e.g. reader.{user}.c1.kubesail.io)
name: reader
spec:
rules:
- hosts:
- "reader.$KUBESAIL_INGRESS_DOMAIN"
http:
paths:
- backend:
serviceName: gaia-svc
servicePort: 8008
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment