Hi, I need some advice
I honestly haven’t googled yet, there are usually a lot of options out there, maybe someone has experience and will share the right solution right away.
In my application, I use Valkey as an intermediate fast storage of settings that are available to different services in the application. Roughly there are several different scripts and components that take settings from the Valkey database.
Right now I’m in the process of developing locally and using Docker-compose
version: '3.7'
services:
valkey:
image: valkey/valkey:8
environment:
- ALLOW_EMPTY_PASSWORD=yes
ports:
- "6379:6379"
volumes:
- valkey_data:/data
volumes:
valkey_data:
Everything works great, I want to do the same thing in kubernetes cluster.
Perhaps someone has a simple path or YAML file to run Valkey in Kubernetes? So that other pods can connect to it without problems and password.
I don’t need multiple replicas or a complex configuration.
In general, for my project I built this manifest and it works fine.
apiVersion: v1
kind: PersistentVolume
metadata:
name: valkey-pv
spec:
capacity:
storage: 1Gi
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Retain
hostPath:
path: "/mnt/data/valkey"
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: valkey-pvc
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: valkey
spec:
replicas: 1
selector:
matchLabels:
app: valkey
template:
metadata:
labels:
app: valkey
spec:
containers:
- name: valkey
image: valkey/valkey:8
resources:
requests:
memory: "512Mi"
cpu: "300m"
limits:
memory: "1Gi"
cpu: "600m"
env:
- name: ALLOW_EMPTY_PASSWORD
value: "yes"
ports:
- containerPort: 6379
volumeMounts:
- name: valkey-data
mountPath: /data
volumes:
- name: valkey-data
persistentVolumeClaim:
claimName: valkey-pvc
---
apiVersion: v1
kind: Service
metadata:
name: valkey-service
spec:
selector:
app: valkey
ports:
- protocol: TCP
port: 6379
targetPort: 6379
type: ClusterIP