You are viewing documentation for a release that is no longer maintainedSee documentation for the latest supported version 3 or the latest supported version 4.2.3.4.2. Pod の非アフィニティー 以下の例は、一致するラベルとラベルセレクターを持つ Pod についての Pod の非アフィニティーを示しています。 Pod pod-s1 にはラベル security:s1 が付けられています。 cat pod-s1.yaml apiVersion: v1 kind: Pod metadata: name: pod-s1 labels: security: s1 spec: containers: - name: ocp image: docker.io/ocpqe/hello-pod cat pod-s1.yaml apiVersion: v1 kind: Pod metadata: name: pod-s1 labels: security: s1 spec: containers: - name: ocp image: docker.io/ocpqe/hello-pod Copy to Clipboard Copied! Toggle word wrap Toggle overflow Pod pod-s2 には、podAntiAffinity の下にラベルセレクター security:s1 が付けられています。 cat pod-s2.yaml apiVersion: v1 kind: Pod metadata: name: pod-s2 spec: affinity: podAntiAffinity: requiredDuringSchedulingIgnoredDuringExecution: - labelSelector: matchExpressions: - key: security operator: In values: - s1 topologyKey: kubernetes.io/hostname containers: - name: pod-antiaffinity image: docker.io/ocpqe/hello-pod cat pod-s2.yaml apiVersion: v1 kind: Pod metadata: name: pod-s2 spec: affinity: podAntiAffinity: requiredDuringSchedulingIgnoredDuringExecution: - labelSelector: matchExpressions: - key: security operator: In values: - s1 topologyKey: kubernetes.io/hostname containers: - name: pod-antiaffinity image: docker.io/ocpqe/hello-pod Copy to Clipboard Copied! Toggle word wrap Toggle overflow Pod pod-s2 は pod-s1 と同じノードにスケジュールできません。 次へ