Skip to content

Instantly share code, notes, and snippets.

@khaosdoctor
Last active August 17, 2022 23:28
Show Gist options
  • Save khaosdoctor/3d67d8855c335d180151bc05142173b5 to your computer and use it in GitHub Desktop.
Save khaosdoctor/3d67d8855c335d180151bc05142173b5 to your computer and use it in GitHub Desktop.
# Deployment for HarperDB
apiVersion: apps/v1
kind: Deployment
metadata:
name: harperdb
namespace: database # note the namespace we created earlier
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 # fixing username, in production this should be a secret
- name: HDB_ADMIN_PASSWORD
value: harperdb # fixing password, in production this should be a secret
resources:
limits:
memory: "1024Mi" # limiting the usage of memory
cpu: "512m" # limiting the usage of CPU to 512 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