4.4.4.2. 一致するラベルのないノードのアフィニティー
以下の例は、一致するラベルを持たないノードと Pod のノードのアフィニティーを示しています。
Node1 ノードにはラベル
zone:emeaがあります。$ oc label node node1 zone=emeaヒントあるいは、以下の YAML を適用してラベルを追加できます。
kind: Node apiVersion: v1 metadata: name: <node_name> labels: zone: emea #...pod-s1 pod にはノードアフィニティーの required (必須) ルールの下に
zoneとusのキー/値のペアがあります。$ cat pod-s1.yaml出力例
apiVersion: v1 kind: Pod metadata: name: pod-s1 spec: securityContext: runAsNonRoot: true seccompProfile: type: RuntimeDefault containers: - image: "docker.io/ocpqe/hello-pod" name: hello-pod securityContext: allowPrivilegeEscalation: false capabilities: drop: [ALL] affinity: nodeAffinity: requiredDuringSchedulingIgnoredDuringExecution: nodeSelectorTerms: - matchExpressions: - key: "zone" operator: In values: - us #...pod-s1 pod は Node1 でスケジュールすることができません。
$ oc describe pod pod-s1出力例
... Events: FirstSeen LastSeen Count From SubObjectPath Type Reason --------- -------- ----- ---- ------------- -------- ------ 1m 33s 8 default-scheduler Warning FailedScheduling No nodes are available that match all of the following predicates:: MatchNodeSelector (1).