3.2.2. 스케줄러 정책 파일 생성

원하는 서술자 및 우선순위로 JSON 파일을 생성하여 기본 예약 동작을 변경할 수 있습니다. 그런 다음 JSON 파일에서 구성 맵을 생성하고 이 구성 맵을 사용하도록 cluster 스케줄러 오브젝트를 가리킵니다.

프로세스

스케줄러 일정을 구성하려면 다음을 수행합니다.

  1. 원하는 서술자 및 우선순위를 사용하여 policy.cfg라는 JSON 파일을 생성합니다.

    스케줄러 JSON 파일 샘플

    {
    "kind" : "Policy",
    "apiVersion" : "v1",
    "predicates" : [ 1
            {"name" : "MaxGCEPDVolumeCount"},
            {"name" : "GeneralPredicates"},
            {"name" : "MaxAzureDiskVolumeCount"},
            {"name" : "MaxCSIVolumeCountPred"},
            {"name" : "CheckVolumeBinding"},
            {"name" : "MaxEBSVolumeCount"},
            {"name" : "MatchInterPodAffinity"},
            {"name" : "CheckNodeUnschedulable"},
            {"name" : "NoDiskConflict"},
            {"name" : "NoVolumeZoneConflict"},
            {"name" : "PodToleratesNodeTaints"}
            ],
    "priorities" : [ 2
            {"name" : "LeastRequestedPriority", "weight" : 1},
            {"name" : "BalancedResourceAllocation", "weight" : 1},
            {"name" : "ServiceSpreadingPriority", "weight" : 1},
            {"name" : "NodePreferAvoidPodsPriority", "weight" : 1},
            {"name" : "NodeAffinityPriority", "weight" : 1},
            {"name" : "TaintTolerationPriority", "weight" : 1},
            {"name" : "ImageLocalityPriority", "weight" : 1},
            {"name" : "SelectorSpreadPriority", "weight" : 1},
            {"name" : "InterPodAffinityPriority", "weight" : 1},
            {"name" : "EqualPriority", "weight" : 1}
            ]
    }

    1
    필요한 경우 서술자를 추가합니다.
    2
    필요한 경우 우선순위를 추가합니다.
  2. 스케줄러 JSON 파일을 기반으로 구성 맵을 생성합니다.

    $ oc create configmap -n openshift-config --from-file=policy.cfg <configmap-name> 1
    1
    구성 맵의 이름을 입력합니다.

    예를 들면 다음과 같습니다.

    $ oc create configmap -n openshift-config --from-file=policy.cfg scheduler-policy

    출력 예

    configmap/scheduler-policy created

  3. Scheduler Operator 사용자 정의 리소스를 편집하여 구성 맵을 추가합니다.

    $ oc patch Scheduler cluster --type='merge' -p '{"spec":{"policy":{"name":"<configmap-name>"}}}' --type=merge 1
    1
    구성 맵 이름을 지정합니다.

    예를 들면 다음과 같습니다.

    $ oc patch Scheduler cluster --type='merge' -p '{"spec":{"policy":{"name":"scheduler-policy"}}}' --type=merge

    Scheduler 구성 리소스를 변경한 후 openshift-kube-apiserver Pod가 재배포될 때까지 기다립니다. 이 작업은 몇 분 정도 걸릴 수 있습니다. Pod가 재배포될 때까지 새 스케줄러가 적용되지 않습니다.

  4. openshift-kube-scheduler 네임스페이스에서 스케줄러 Pod의 로그를 확인하여 스케줄러 정책이 구성되었는지 확인합니다. 다음 명령은 스케줄러에서 등록하는 서술자 및 우선순위가 있는지 확인합니다.

    $ oc logs <scheduler-pod> | grep predicates

    예를 들면 다음과 같습니다.

    $ oc logs openshift-kube-scheduler-ip-10-0-141-29.ec2.internal | grep predicates

    출력 예

    Creating scheduler with fit predicates 'map[MaxGCEPDVolumeCount:{} MaxAzureDiskVolumeCount:{} CheckNodeUnschedulable:{} NoDiskConflict:{} NoVolumeZoneConflict:{} GeneralPredicates:{} MaxCSIVolumeCountPred:{} CheckVolumeBinding:{} MaxEBSVolumeCount:{} MatchInterPodAffinity:{} PodToleratesNodeTaints:{}]' and priority functions 'map[InterPodAffinityPriority:{} LeastRequestedPriority:{} ServiceSpreadingPriority:{} ImageLocalityPriority:{} SelectorSpreadPriority:{} EqualPriority:{} BalancedResourceAllocation:{} NodePreferAvoidPodsPriority:{} NodeAffinityPriority:{} TaintTolerationPriority:{}]'