-
Notifications
You must be signed in to change notification settings - Fork 0
/
k8s-redis.yml
79 lines (75 loc) · 1.38 KB
/
k8s-redis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
apiVersion: v1
kind: PersistentVolume
metadata:
name: pv-redis
spec:
capacity:
storage: 2Gi
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Retain
storageClassName: local-path
volumeMode: Filesystem
hostPath:
path: /data/k8s-store-pv/pv-redis
type: DirectoryOrCreate
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: pvc-redis
namespace: app
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
storageClassName: local-path
volumeMode: Filesystem
volumeName: pv-redis
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: dep-redis
namespace: app
spec:
replicas: 1
selector:
matchLabels:
name: dep-redis
template:
metadata:
labels:
name: dep-redis
spec:
containers:
- name: redis
image: redis
command: [ "redis-server" , "--requirepass" , "1@#4" ]
volumeMounts:
- mountPath: "/data"
name: pvc-redis
resources:
limits:
cpu: 1
memory: 256Mi
volumes:
- name: pvc-redis
persistentVolumeClaim:
claimName: pvc-redis
---
apiVersion: v1
kind: Service
metadata:
name: svc-redis
namespace: app
spec:
selector:
name: dep-redis
type: NodePort
ports:
- port: 6379
targetPort: 6379
nodePort: 31379