我正在寻找使用亲和力创建一个有状态集。我为我的 3 个节点添加了一个标签。其中两个有area=area1,一个节点有area=area2。我希望仅在 area=area1 的节点上运行我的 statefulset pod。它不工作。我从调度程序收到一个错误,即没有匹配的节点。我正在运行 Kubernetes v1.7.4
yaml:
apiVersion: apps/v1beta1
kind: StatefulSet
metadata:
name: stateful-bcs
spec:
serviceName: mybcs
replicas: 2
template:
metadata:
labels:
app: simplecount
spec:
affinity:
podAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: area
operator: In
values:
- area1
containers:
- name: test1
image: XXXX.azurecr.io/simple
env:
- name: SIMPLE_SERVICE_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
command:
- ./simplecount
- "$(SIMPLE_SERVICE_NAME)"
imagePullSecrets:
- name: XXXXXXX
restartPolicy: Always