Skip to content

Instantly share code, notes, and snippets.

@khaosdoctor
Created August 8, 2022 18:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save khaosdoctor/bcd0a3c1e3a8d8b8c167b4f23760dd99 to your computer and use it in GitHub Desktop.
Save khaosdoctor/bcd0a3c1e3a8d8b8c167b4f23760dd99 to your computer and use it in GitHub Desktop.
---
# Source: harperdb/templates/persistentVolumeClaim.yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: harperdb-data
namespace: database
spec:
resources:
requests:
storage: 2Gi # We'll request 2GB of storage
accessModes:
- ReadWriteOnce
storageClassName: azurefile-csi # We'll use the Azure File storage
---
# Source: harperdb/templates/service.yaml
apiVersion: v1
kind: Service
metadata:
name: harperdb
namespace: database
spec:
selector:
app: harperdb
ports:
- port: 9925
name: api
targetPort: hdb-api
---
# Source: harperdb/templates/deployment.yaml
# Deployment for HarperDB
apiVersion: apps/v1
kind: Deployment
metadata:
name: harperdb
namespace: database
spec:
selector:
matchLabels:
app: harperdb # group all the pods under the same label
template:
metadata:
labels:
app: harperdb # create pods with the label we want to group them under
spec:
containers:
- name: harperdb-container
image: harperdb/harperdb # same hdb image from dockerhub
env:
- name: HDB_ADMIN_USERNAME
value: "harperdb"
- name: HDB_ADMIN_PASSWORD
value: "harperdb"
resources:
limits:
memory: "512Mi" # limiting the usage of memory
cpu: "128m" # limiting the usage of CPU to 128 millicores
ports:
- containerPort: 9925 # exposing the port 9925 to the outside world
name: hdb-api # naming the port
volumeMounts: # creating a persistent volume to store the data
- mountPath: "/opt/harperdb" # mounting the volume to the path we want
name: hdb-data # referencing the volume we want to mount
livenessProbe: # creating a liveness probe to check if the container is running
tcpSocket: # we'll ping hdb's port 9925
port: 9925
initialDelaySeconds: 30 # wait 30 seconds before starting the probe
periodSeconds: 10 # then check the probe every 10 seconds
readinessProbe: # creating a readiness probe to check if the container is ready to accept connections
tcpSocket:
port: 9925
initialDelaySeconds: 10 # wait 10 seconds before starting the probe
periodSeconds: 5 # then check the probe every 5 seconds
volumes:
- name: hdb-data # this is the volume we'll mount
persistentVolumeClaim: # it references another persistent volume claim
claimName: harperdb-data # this is the name of the persistent volume claim
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment