Redis安装手册
本教程仅进行本地数据持久化,请勿用于生产环境。
apiVersion: apps/v1
kind: Deployment
metadata:
name: redis
spec:
replicas: 1
selector:
matchLabels:
app: redis
template:
metadata:
labels:
app: redis
spec:
containers:
- name: redis
command: ["redis-server", "/usr/local/etc/redis/redis.conf"]
image: swr.cn-east-3.myhuaweicloud.com/lomtom-common/redis:8.0.2
ports:
- containerPort: 6379
volumeMounts:
- name: redis-data
mountPath: /data
- name: redis-config
mountPath: /usr/local/etc/redis/redis.conf
subPath: redis.conf
env:
- name: TZ
value: Asia/Shanghai
volumes:
- name: redis-data
hostPath:
path: /data/lomtom/redis
type: DirectoryOrCreate
- name: redis-config
configMap:
name: redis-config
---
apiVersion: v1
kind: ConfigMap
metadata:
name: redis-config
data:
redis.conf: |
# Redis configuration
appendonly yes
ignore-warnings ARM64-COW-BUG
---
apiVersion: v1
kind: Service
metadata:
name: redis
spec:
selector:
app: redis
ports:
- protocol: TCP
port: 6379
targetPort: 6379
type: NodePort