-
Notifications
You must be signed in to change notification settings - Fork 166
/
03-sts.yaml
73 lines (73 loc) · 1.68 KB
/
03-sts.yaml
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
---
apiVersion: v1
kind: Service
metadata:
name: sts-volume-test
namespace: default
spec:
selector:
app: test-sts
clusterIP: None
ports:
- port: 80
targetPort: 80
protocol: TCP
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: sts-volume-test
namespace: default
labels:
app: test-sts
spec:
replicas: 2
selector:
matchLabels:
app: test-sts
serviceName: sts-volume-test
template:
metadata:
labels:
app: test-sts
spec:
containers:
- name: volume-test
image: nginx:1.23.4-alpine
imagePullPolicy: IfNotPresent
ports:
- containerPort: 80
name: http
protocol: TCP
volumeMounts:
- mountPath: /data
name: sts-volume
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/hostname
operator: In
values:
- ws3.kryukov.local
- ws4.kryukov.local
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: app
operator: In
values:
- test-sts
topologyKey: "kubernetes.io/hostname"
volumeClaimTemplates:
- spec:
accessModes:
- ReadWriteOnce
storageClassName: local-path
resources:
requests:
storage: 200Mi
metadata:
name: sts-volume