Cpte-Boot/k8s/manifests/redis.yaml

272 lines
5.3 KiB
YAML
Raw Normal View History

2026-03-16 23:52:17 +08:00
kind: Secret
apiVersion: v1
metadata:
name: redis-secret
namespace: cpte-wms
creationTimestamp: '2026-03-16T07:02:43Z'
annotations:
kubesphere.io/creator: admin
kubesphere.io/description: 信息配置
data:
REDIS_IP: MC4wLjAuMA==
REDIS_PASSWORD: Y3B0ZUAxMjM=
REDIS_PORT: NjM3OQ==
type: Opaque
---
kind: ConfigMap
apiVersion: v1
metadata:
name: redis-conf
namespace: cpte-wms
creationTimestamp: '2026-03-16T07:04:50Z'
annotations:
kubesphere.io/creator: admin
kubesphere.io/description: 配置文件
data:
redis.conf: |-
bind 0.0.0.0
protected-mode yes
tcp-backlog 511
timeout 0
daemonize no
pidfile /data/redis.pid
loglevel notice
logfile ""
databases 16
always-show-logo no
set-proc-title yes
proc-title-template "{title} {listen-addr} {server-mode}"
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename dump.rdb
rdb-del-sync-files no
dir /data
replica-serve-stale-data yes
replica-read-only yes
repl-diskless-sync yes
repl-diskless-sync-delay 5
repl-diskless-load disabled
repl-disable-tcp-nodelay no
replica-priority 100
acllog-max-len 128
lazyfree-lazy-eviction no
lazyfree-lazy-expire no
lazyfree-lazy-server-del no
replica-lazy-flush no
lazyfree-lazy-user-del no
lazyfree-lazy-user-flush no
oom-score-adj no
oom-score-adj-values 0 200 800
disable-thp yes
appendonly yes
appendfilename "appendonly.aof"
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
aof-load-truncated yes
aof-use-rdb-preamble yes
slowlog-log-slower-than 10000
slowlog-max-len 128
latency-monitor-threshold 0
notify-keyspace-events ""
list-compress-depth 0
set-max-intset-entries 512
hll-sparse-max-bytes 3000
stream-node-max-bytes 4096
stream-node-max-entries 100
activerehashing yes
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit replica 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
hz 10
dynamic-hz yes
aof-rewrite-incremental-fsync yes
rdb-save-incremental-fsync yes
jemalloc-bg-thread yes
---
apiVersion: v1
kind: Service
metadata:
name: redis-headless
namespace: cpte-wms
labels:
app: redis
spec:
clusterIP: None
selector:
app: redis
ports:
- port: 6379
targetPort: 6379
name: redis
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: redis
namespace: cpte-wms
labels:
app: redis
annotations:
kubesphere.io/description: "6.2.19"
spec:
serviceName: redis-headless
replicas: 1
selector:
matchLabels:
app: redis
template:
metadata:
labels:
app: redis
spec:
containers:
- name: redis
image: docker.io/library/redis:6.2.19
imagePullPolicy: IfNotPresent
command: ['sh', '-c', 'exec redis-server /etc/redis/redis.conf --requirepass "$REDIS_PASSWORD"']
ports:
- containerPort: 6379
name: redis
env:
- name: REDIS_PASSWORD
valueFrom:
secretKeyRef:
name: redis-secret
key: REDIS_PASSWORD
volumeMounts:
- name: redis-data
mountPath: /data
- name: redis-config
mountPath: /etc/redis/redis.conf
subPath: redis.conf
readOnly: true
- name: host-time
mountPath: /etc/localtime
readOnly: true
livenessProbe:
exec:
command: ['sh', '-c', 'redis-cli -a "$REDIS_PASSWORD" ping | grep -q PONG']
initialDelaySeconds: 30
periodSeconds: 10
failureThreshold: 3
readinessProbe:
exec:
command: ['sh', '-c', 'redis-cli -a "$REDIS_PASSWORD" ping | grep -q PONG']
initialDelaySeconds: 5
periodSeconds: 5
failureThreshold: 3
startupProbe:
exec:
command: ['sh', '-c', 'redis-cli -a "$REDIS_PASSWORD" ping | grep -q PONG']
initialDelaySeconds: 0
periodSeconds: 5
failureThreshold: 30
resources:
requests:
memory: "256Mi"
cpu: "100m"
limits:
memory: "1Gi"
cpu: "500m"
volumes:
- name: redis-config
configMap:
name: redis-conf
- name: host-time
hostPath:
path: /etc/localtime
type: File
volumeClaimTemplates:
- metadata:
name: redis-data
spec:
accessModes: ["ReadWriteOnce"]
storageClassName: local
resources:
requests:
storage: 10Gi
---
kind: Service
apiVersion: v1
metadata:
name: redis-service
namespace: cpte-wms
labels:
app: redis
spec:
ports:
- name: redis
protocol: TCP
port: 6379
targetPort: 6379
selector:
app: redis
clusterIP: 10.233.50.165
clusterIPs:
- 10.233.50.165
2026-03-20 17:07:12 +08:00
type: ClusterIP
2026-03-16 23:52:17 +08:00
sessionAffinity: None
ipFamilies:
- IPv4
ipFamilyPolicy: SingleStack
2026-03-20 17:07:12 +08:00
internalTrafficPolicy: Cluster