노드에 있어도 잘 작동하지만 같은 노드에 있다면 네트워크를 거치지 않고 통신할 수 있어 더
좋을 것이다. 스케줄러에게 두 개의 파드를 함께 배치하도록 요청하는 방법은 무엇일까?
다음은
server
파드 스펙의 일부로 파드 어피티니를 요청하는 예제다.
cache
파드 스펙에 설
정하거나
server
,
cache
파드 스펙 둘 다에서 파드 어피니티를 설정하더라도 결과는 동일
하다.
apiVersion: v1
kind: Pod
metadata:
name: server
labels:
app: server
...
spec:
affinity:
podAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
labelSelector:
-
matchExpressions:
-
key: app
operator:
In
values:
["cache"]
topologyKey:
kubernetes.io/hostname
파드 어피니티의 요청으로 스케줄러는
server ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month, and much more.