-
-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathcounter-with-volume.yml
113 lines (113 loc) · 2.02 KB
/
counter-with-volume.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: redis
spec:
serviceName: redis
persistentVolumeClaimRetentionPolicy:
whenDeleted: Retain
whenScaled: Delete
volumeClaimTemplates:
- metadata:
name: redis
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
selector:
matchLabels:
app: redis
replicas: 1
template:
metadata:
labels:
app: redis
spec:
containers:
- name: redis
image: redis
command:
- redis-server
args:
- --appendonly
- "yes"
resources:
requests:
cpu: 30m
memory: 50Mi
ports:
- containerPort: 6379
volumeMounts:
- mountPath: /data
name: redis
volumes:
- name: redis
persistentVolumeClaim:
claimName: redis
---
apiVersion: v1
kind: Service
metadata:
name: redis
spec:
selector:
app: redis
ports:
- port: 6379
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: counter
spec:
selector:
matchLabels:
app: counter
replicas: 2
template:
metadata:
labels:
app: counter
spec:
containers:
- name: counter
image: ghcr.io/ondrejsika/counter
resources:
requests:
cpu: 20m
memory: 10Mi
env:
- name: REDIS
value: redis
ports:
- containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
name: counter
spec:
type: NodePort
selector:
app: counter
ports:
- port: 80
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: counter
spec:
rules:
- host: counter.127.0.0.1.nip.io
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: counter
port:
number: 80