Skip to content

Commit 7f5ac2b

Browse files
committed
feat(#677): Helm chart to deploy HelixDB on Kubernetes
1 parent 634fa94 commit 7f5ac2b

File tree

7 files changed

+185
-0
lines changed

7 files changed

+185
-0
lines changed

k8s/Dockerfile

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Runtime image based on Debian
2+
FROM debian:bookworm-slim
3+
4+
# Set working directory
5+
WORKDIR /app
6+
7+
# Install runtime dependencies
8+
RUN apt-get update && apt-get install -y \
9+
ca-certificates \
10+
&& rm -rf /var/lib/apt/lists/*
11+
12+
# Copy the helix-container binary
13+
COPY ./helix-container /usr/local/bin/helix-container
14+
RUN chmod +x /usr/local/bin/helix-container
15+
16+
# Create data directory and set permissions
17+
# - chown root:0 allows random OpenShift UIDs (which belong to group 0)
18+
# - chmod g+rwX allows write access to group 0
19+
RUN mkdir -p /data && chown -R root:0 /data && chmod -R g+rwX /data
20+
21+
# Define environment variable for data path
22+
ENV HELIX_DATA_DIR=/data
23+
24+
# Optional: declare a non-root default UID (still OpenShift-safe)
25+
USER 1001
26+
27+
# Entry point
28+
ENTRYPOINT ["/usr/local/bin/helix-container"]

k8s/README.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# HelixDB Kubernetes Deployment
2+
3+
This repository contains a **Helm chart** and a **Docker image** to deploy the `helixdb` binary as a containerized service on Kubernetes.
4+
5+
The deployment is designed to run in a **minimal Debian-based container** and uses a **Persistent Volume Claim** for data storage.
6+
7+
---
8+
9+
## Docker Image
10+
11+
The container image runs the the `helix-container` binary which was compiled with the helix push tool previously.
12+
13+
## Build and Push
14+
15+
The Helm chart is located in the helm/ directory and provides a configurable Kubernetes deployment, service, and persistent volume claim.
16+
17+
### Helm Chart Structure
18+
19+
The Helm chart is located in the `helm/` directory and provides a configurable Kubernetes deployment, service, and persistent volume claim.
20+
21+
```text
22+
helm/
23+
├── Chart.yaml # Chart metadata
24+
├── values.yaml # Default configuration values
25+
└── templates/
26+
├── deployment.yaml # Deployment definition
27+
├── pvc.yaml # PersistentVolumeClaim definition
28+
└── service.yaml # Service definition
29+
```
30+
31+
32+
## Deploying to Kubernetes
33+
34+
helm install helixdb ./helm -n your-namespace --create-namespace
35+
36+
## using an existing PVC
37+
38+
If you are using a previously created PVC, make sure it has accessModes of type ReadWriteOncePod and includes the following annotations:
39+
40+
* app.kubernetes.io/managed-by=Helm
41+
* meta.helm.sh/release-namespace=<namespace>
42+
* meta.helm.sh/release-name=helixdb
43+
44+
## Notes
45+
46+
The container uses non-root UID 1001 for security and OpenShift compatibility.
47+
48+
The HELIX_DATA_DIR environment variable points to /data, which is mounted via a PersistentVolumeClaim.
49+
50+
All configurations are customizable via values.yaml.

k8s/helm/Chart.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
apiVersion: v2
2+
name: helixdb
3+
description: Helm chart to deploy helixdb with a single replica and ReadWriteOncePod PVC
4+
type: application
5+
version: 0.1.0
6+
appVersion: "2.1.2"

k8s/helm/templates/deployment.yaml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: helixdb
5+
namespace: {{ .Values.namespace }}
6+
labels:
7+
app: helixdb
8+
spec:
9+
replicas: 1
10+
selector:
11+
matchLabels:
12+
app: helixdb
13+
template:
14+
metadata:
15+
labels:
16+
app: helixdb
17+
spec:
18+
securityContext: {}
19+
containers:
20+
- name: helixdb
21+
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
22+
imagePullPolicy: {{ .Values.image.pullPolicy }}
23+
command: ["/usr/local/bin/helix-container"]
24+
securityContext: {}
25+
ports:
26+
- containerPort: {{ .Values.service.port }}
27+
volumeMounts:
28+
- name: data
29+
mountPath: /data
30+
{{- with .Values.resources }}
31+
resources:
32+
{{ toYaml . | indent 12 }}
33+
{{- end }}
34+
volumes:
35+
- name: data
36+
persistentVolumeClaim:
37+
claimName: {{ .Values.pvc.name }}
38+

k8s/helm/templates/pvc.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
apiVersion: v1
2+
kind: PersistentVolumeClaim
3+
metadata:
4+
name: {{ .Values.pvc.name }}
5+
namespace: {{ .Values.namespace }}
6+
spec:
7+
# Force ReadWriteOncePod mode
8+
accessModes:
9+
- ReadWriteOncePod
10+
resources:
11+
requests:
12+
storage: {{ .Values.pvc.size }}
13+
{{- if .Values.pvc.storageClassName }}
14+
storageClassName: {{ .Values.pvc.storageClassName }}
15+
{{- end }}
16+

k8s/helm/templates/service.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: helixdb-service
5+
namespace: {{ .Values.namespace }}
6+
spec:
7+
selector:
8+
app: helixdb
9+
ports:
10+
- name: helixdb
11+
protocol: TCP
12+
port: {{ .Values.service.port }}
13+
targetPort: {{ .Values.service.port }}
14+

k8s/helm/values.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Namespace for the deployment
2+
namespace: helixdb
3+
4+
image:
5+
# Image repository and tag
6+
repository: ""
7+
tag: ""
8+
pullPolicy: IfNotPresent
9+
10+
service:
11+
# TCP port used by the application
12+
port: 6969
13+
14+
pvc:
15+
# PVC name (required)
16+
name: helixdb-data
17+
# Optional storage class (default = cluster default)
18+
storageClassName: ""
19+
# Requested storage size
20+
size: ""
21+
22+
23+
# ---------------------------------------------------------------------------
24+
# 🔹 Resources for the main Deployment container
25+
# ---------------------------------------------------------------------------
26+
resources:
27+
requests:
28+
cpu: ""
29+
memory: ""
30+
limits:
31+
cpu: ""
32+
memory: ""
33+

0 commit comments

Comments
 (0)