3.9.3.2. 多个 pod 拓扑分布约束示例
此 Pod spec 示例定义了两个 pod 拓扑分布限制。标签为 foo:bar 的 pod 上的匹配,指定为 skew 1,并在不满足这些要求时不调度 pod。
第一个限制基于用户定义的标签 node 发布 pod,第二个约束根据用户定义的标签 rack 分发 pod。调度 pod 必须满足这两个限制。
kind: Pod
apiVersion: v1
metadata:
name: my-pod-2
labels:
foo: bar
spec:
topologySpreadConstraints:
- maxSkew: 1
topologyKey: node
whenUnsatisfiable: DoNotSchedule
labelSelector:
matchLabels:
foo: bar
- maxSkew: 1
topologyKey: rack
whenUnsatisfiable: DoNotSchedule
labelSelector:
matchLabels:
foo: bar
containers:
- image: "docker.io/ocpqe/hello-pod"
name: hello-pod