generated from cybozu-go/neco-template
-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathanti-affinity.yaml
44 lines (44 loc) · 1.2 KB
/
anti-affinity.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
# This example shows how to schedule Pods on different Nodes.
apiVersion: moco.cybozu.com/v1beta2
kind: MySQLCluster
metadata:
namespace: default
name: test
spec:
replicas: 3
podTemplate:
spec:
affinity:
# The anti-affinity for Pods
# cf. https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#inter-pod-affinity-and-anti-affinity
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: app.kubernetes.io/name
operator: In
values:
- mysql
- key: app.kubernetes.io/instance
operator: In
values:
- test
topologyKey: "kubernetes.io/hostname"
containers:
- name: mysqld
image: ghcr.io/cybozu-go/moco/mysql:8.4.4
resources:
requests:
cpu: "10"
memory: "10Gi"
limits:
cpu: "10"
memory: "10Gi"
volumeClaimTemplates:
- metadata:
name: mysql-data
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: 1Gi