我正在尝试为 mongodb 试验 2 节点集群(一旦稳定后将进行扩展)。这是使用 EKS。这 2 个节点在两个不同的 aws 区域中运行。描述符如下:
apiVersion: apps/v1beta1
kind: StatefulSet
metadata:
name: mongod
labels:
name: mongo-repl
spec:
serviceName: mongodb-service
replicas: 2
selector:
matchLabels:
app: mongod
role: mongo
environment: test
template:
metadata:
labels:
app: mongod
role: mongo
environment: test
spec:
terminationGracePeriodSeconds: 15
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: failure-domain.beta.kubernetes.io/zone
operator: In
values:
- ap-south-1a
- ap-south-1b
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: app
operator: In
values:
- mongod
- key: role
operator: In
values: …Run Code Online (Sandbox Code Playgroud)