검색

12.2. 테인트 및 허용 오차를 사용하여 로깅 Pod 배치 제어

download PDF

테인트 및 허용 오차를 사용하면 노드에서 예약해야 하는 (또는 예약해서는 안 되는) Pod를 제어할 수 있습니다.

12.2.1. 테인트(Taints) 및 톨러레이션(Tolerations)의 이해

테인트를 사용하면 Pod에 일치하는 허용 오차가 없는 경우 노드에서 Pod 예약을 거부할 수 있습니다.

Node 사양(NodeSpec)을 통해 노드에 테인트를 적용하고 Pod 사양(PodSpec)을 통해 Pod에 허용 오차를 적용합니다. 노드에 테인트를 적용할 때 Pod에서 테인트를 허용할 수 없는 경우 스케줄러에서 해당 노드에 Pod를 배치할 수 없습니다.

노드 사양의 테인트 예

apiVersion: v1
kind: Node
metadata:
  name: my-node
#...
spec:
  taints:
  - effect: NoExecute
    key: key1
    value: value1
#...

Pod 사양의 허용 오차 예

apiVersion: v1
kind: Pod
metadata:
  name: my-pod
#...
spec:
  tolerations:
  - key: "key1"
    operator: "Equal"
    value: "value1"
    effect: "NoExecute"
    tolerationSeconds: 3600
#...

테인트 및 톨러레이션은 key, value 및 effect로 구성되어 있습니다.

표 12.1. 테인트 및 톨러레이션 구성 요소
매개변수설명

key

key는 최대 253 자의 문자열입니다. 키는 문자 또는 숫자로 시작해야 하며 문자, 숫자, 하이픈, 점, 밑줄을 포함할 수 있습니다.

value

value는 최대 63 자의 문자열입니다. 값은 문자 또는 숫자로 시작해야 하며 문자, 숫자, 하이픈, 점, 밑줄을 포함할 수 있습니다.

effect

다음 명령 중 하나를 실행합니다.

NoSchedule [1]

  • 테인트에 일치하지 않는 새 pod는 해당 노드에 예약되지 않습니다.
  • 노드의 기존 pod는 그대로 유지됩니다.

PreferNoSchedule

  • 테인트와 일치하지 않는 새 pod는 해당 노드에 예약할 수 있지만 스케줄러는 그렇게하지 않습니다.
  • 노드의 기존 pod는 그대로 유지됩니다.

NoExecute

  • 테인트에 일치하지 않는 새 pod는 해당 노드에 예약할 수 없습니다.
  • 일치하는 톨러레이션이 없는 노드의 기존 pod는 제거됩니다.

operator

Equal

key/value/effect 매개변수가 일치해야합니다. 이는 기본값입니다.

Exists

key/effect 매개변수가 일치해야합니다. 일치하는 빈 value 매개변수를 남겨 두어야합니다.

  1. 컨트롤 플레인 노드에 NoSchedule 테인트를 추가하는 경우 노드에 기본적으로 추가되는 node-role.kubernetes.io/master=:NoSchedule 테인트가 있어야 합니다.

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

    apiVersion: v1
    kind: Node
    metadata:
      annotations:
        machine.openshift.io/machine: openshift-machine-api/ci-ln-62s7gtb-f76d1-v8jxv-master-0
        machineconfiguration.openshift.io/currentConfig: rendered-master-cdc1ab7da414629332cc4c3926e6e59c
      name: my-node
    #...
    spec:
      taints:
      - effect: NoSchedule
        key: node-role.kubernetes.io/master
    #...

톨러레이션은 테인트와 일치합니다.

  • operator 매개변수가 Equal로 설정된 경우:

    • key 매개변수는 동일합니다.
    • value 매개변수는 동일합니다.
    • effect 매개변수는 동일합니다.
  • operator 매개변수가 Exists로 설정된 경우:

    • key 매개변수는 동일합니다.
    • effect 매개변수는 동일합니다.

다음 테인트는 OpenShift Container Platform에 빌드됩니다.

  • node.kubernetes.io/not-ready: 노드가 준비 상태에 있지 않습니다. 이는 노드 조건 Ready=False에 해당합니다.
  • node.kubernetes.io/unreachable: 노드가 노드 컨트롤러에서 연결할 수 없습니다. 이는 노드 조건 Ready=Unknown에 해당합니다.
  • node.kubernetes.io/memory-pressure: 노드에 메모리 부족 문제가 있습니다. 이는 노드 조건 MemoryPressure=True에 해당합니다.
  • node.kubernetes.io/disk-pressure: 노드에 디스크 부족 문제가 있습니다. 이는 노드 조건 DiskPressure=True에 해당합니다.
  • node.kubernetes.io/network-unavailable: 노드 네트워크를 사용할 수 없습니다.
  • node.kubernetes.io/unschedulable: 노드를 예약할 수 없습니다.
  • node.cloudprovider.kubernetes.io/uninitialized: 노드 컨트롤러가 외부 클라우드 공급자로 시작되면 이 테인트 노드에 사용 불가능으로 표시됩니다. cloud-controller-manager의 컨트롤러가 이 노드를 초기화하면 kubelet이 이 테인트를 제거합니다.
  • node.kubernetes.io/pid-pressure: 노드에 pid pressure가 있습니다. 이는 노드 조건 PIDPressure=True 에 해당합니다.

    중요

    OpenShift Container Platform은 기본 pid.available evictionHard 를 설정하지 않습니다.

12.2.2. 허용 오차를 사용하여 로그 저장소 Pod 배치 제어

기본적으로 로그 저장소 Pod에는 다음과 같은 허용 오차 구성이 있습니다.

Elasticsearch 로그 저장소 Pod 기본 허용 오차

apiVersion: v1
kind: Pod
metadata:
  name: elasticsearch-example
  namespace: openshift-logging
spec:
# ...
  tolerations:
  - effect: NoSchedule
    key: node.kubernetes.io/disk-pressure
    operator: Exists
  - effect: NoExecute
    key: node.kubernetes.io/not-ready
    operator: Exists
    tolerationSeconds: 300
  - effect: NoExecute
    key: node.kubernetes.io/unreachable
    operator: Exists
    tolerationSeconds: 300
  - effect: NoSchedule
    key: node.kubernetes.io/memory-pressure
    operator: Exists
# ...

LokiStack 로그 저장소 Pod 기본 허용 오차

apiVersion: v1
kind: Pod
metadata:
  name: lokistack-example
  namespace: openshift-logging
spec:
# ...
  tolerations:
  - effect: NoExecute
    key: node.kubernetes.io/not-ready
    operator: Exists
    tolerationSeconds: 300
  - effect: NoExecute
    key: node.kubernetes.io/unreachable
    operator: Exists
    tolerationSeconds: 300
  - effect: NoSchedule
    key: node.kubernetes.io/memory-pressure
    operator: Exists
# ...

테인트를 추가한 다음 ClusterLogging 사용자 정의 리소스(CR)에서 tolerations 구문을 수정하여 로그 저장소 Pod에 대한 허용 오차를 구성할 수 있습니다.

사전 요구 사항

  • Red Hat OpenShift Logging Operator가 설치되어 있습니다.
  • OpenShift CLI(oc)가 설치되어 있습니다.
  • Elasticsearch 또는 LokiStack인 내부 로그 저장소를 배포했습니다.

절차

  1. 다음 명령을 실행하여 로깅 Pod를 예약하려는 노드에 테인트를 추가합니다.

    $ oc adm taint nodes <node_name> <key>=<value>:<effect>

    명령 예

    $ oc adm taint nodes node1 lokistack=node:NoExecute

    이 예에서는 키 lokistack, 값 node 및 taint 효과 NoExecute 가 있는 node1 에 taint를 배치합니다. NoExecute 효과가 있는 노드는 taint와 일치하는 Pod만 스케줄링하고 일치하지 않는 기존 Pod는 제거합니다.

  2. 로그 저장소 Pod에 대한 허용 오차를 구성하려면 ClusterLogging CR의 logstore 섹션을 편집합니다.

    ClusterLogging CR의 예

    apiVersion: logging.openshift.io/v1
    kind: ClusterLogging
    metadata:
    # ...
    spec:
    # ...
      logStore:
        type: lokistack
        elasticsearch:
          nodeCount: 1
          tolerations:
          - key: lokistack 1
            operator: Exists 2
            effect: NoExecute 3
            tolerationSeconds: 6000 4
    # ...

    1
    노드에 추가한 키를 지정합니다.
    2
    노드에 lokistack 키가 있는 테인트를 요구하도록 Exists Operator를 지정합니다.
    3
    NoExecute 효과를 지정합니다.
    4
    선택 사항: tolerationSeconds 매개변수를 지정하여 Pod가 제거되기 전까지 노드에 바인딩되는 시간을 설정합니다.

이 허용 오차는 oc adm taint 명령으로 생성된 taint와 일치합니다. 이 허용 오차가 있는 Pod를 node1 에 예약할 수 있습니다.

12.2.3. 허용 오차를 사용하여 로그 시각화 프로그램 Pod 배치 제어

다른 Pod에 없는 특정 키/값 쌍을 사용하여 Kibana Pod만 지정된 노드에서 실행되도록 할 수 있습니다.

사전 요구 사항

  • Red Hat OpenShift Logging Operator, OpenShift Elasticsearch Operator 및 OpenShift CLI(oc)를 설치했습니다.

절차

  1. 다음 명령을 실행하여 로그 시각화 프로그램 Pod를 예약하려는 노드에 테인트를 추가합니다.

    $ oc adm taint nodes <node_name> <key>=<value>:<effect>

    명령 예

    $ oc adm taint nodes node1 kibana=node:NoExecute

    이 예에서는 키 kibana, 값 node 및 taint 효과 NoExecutenode1에 taint를 배치합니다. NoExecute taint 효과를 사용해야 합니다. NoExecute는 taint와 일치하는 Pod만 스케줄링하고 일치하지 않는 기존 Pod는 제거합니다.

  2. Kibana Pod에 대한 허용 오차를 구성하려면 ClusterLogging CR의 visualization 섹션을 편집합니다.

    apiVersion: logging.openshift.io/v1
    kind: ClusterLogging
    metadata:
    # ...
    spec:
    # ...
      visualization:
        type: kibana
        kibana:
          tolerations:
          - key: kibana  1
            operator: Exists 2
            effect: NoExecute 3
            tolerationSeconds: 6000 4
          resources:
            limits:
              memory: 2Gi
            requests:
              cpu: 100m
              memory: 1Gi
          replicas: 1
    # ...
    1
    노드에 추가한 키를 지정합니다.
    2
    , value 및 effect 매개변수가 일치하도록 Exists Operator를 지정합니다.
    3
    NoExecute 효과를 지정합니다.
    4
    선택적으로 tolerationSeconds 매개변수를 지정하여 Pod가 제거되기 전까지 노드에 바인딩되는 시간을 설정합니다.

이 허용 오차는 oc adm taint 명령으로 생성된 taint와 일치합니다. 이 허용 오차가 있는 Pod는 node1에 스케줄링할 수 있습니다.

12.2.4. 허용 오차를 사용하여 로그 수집기 Pod 배치 제어

기본적으로 로그 수집기 Pod에는 다음과 같은 허용 오차 구성이 있습니다.

apiVersion: v1
kind: Pod
metadata:
  name: collector-example
  namespace: openshift-logging
spec:
# ...
  collection:
    type: vector
    tolerations:
    - effect: NoSchedule
      key: node-role.kubernetes.io/master
      operator: Exists
    - effect: NoSchedule
      key: node.kubernetes.io/disk-pressure
      operator: Exists
    - effect: NoExecute
      key: node.kubernetes.io/not-ready
      operator: Exists
    - effect: NoExecute
      key: node.kubernetes.io/unreachable
      operator: Exists
    - effect: NoSchedule
      key: node.kubernetes.io/memory-pressure
      operator: Exists
    - effect: NoSchedule
      key: node.kubernetes.io/pid-pressure
      operator: Exists
    - effect: NoSchedule
      key: node.kubernetes.io/unschedulable
      operator: Exists
# ...

사전 요구 사항

  • Red Hat OpenShift Logging Operator 및 OpenShift CLI(oc)를 설치했습니다.

절차

  1. 다음 명령을 실행하여 로깅 수집기 Pod에서 로깅 수집기 Pod를 예약할 노드에 테인트를 추가합니다.

    $ oc adm taint nodes <node_name> <key>=<value>:<effect>

    명령 예

    $ oc adm taint nodes node1 collector=node:NoExecute

    이 예에서는 키 collector, 값 node 및 taint 효과 NoExecutenode1에 taint를 배치합니다. NoExecute taint 효과를 사용해야 합니다. NoExecute는 taint와 일치하는 Pod만 스케줄링하고 일치하지 않는 기존 Pod는 제거합니다.

  2. ClusterLogging 사용자 정의 리소스(CR)의 collection 스탠자를 편집하여 로깅 수집기 Pod에 대한 허용 오차를 구성합니다.

    apiVersion: logging.openshift.io/v1
    kind: ClusterLogging
    metadata:
    # ...
    spec:
    # ...
      collection:
        type: vector
        tolerations:
        - key: collector 1
          operator: Exists 2
          effect: NoExecute 3
          tolerationSeconds: 6000 4
        resources:
          limits:
            memory: 2Gi
          requests:
            cpu: 100m
            memory: 1Gi
    # ...
    1
    노드에 추가한 키를 지정합니다.
    2
    key/value/effect 매개변수가 일치할 것을 요구하도록 Exists Operator를 지정합니다.
    3
    NoExecute 효과를 지정합니다.
    4
    선택적으로 tolerationSeconds 매개변수를 지정하여 Pod가 제거되기 전까지 노드에 바인딩되는 시간을 설정합니다.

이 허용 오차는 oc adm taint 명령으로 생성된 taint와 일치합니다. 이 허용 오차가 있는 Pod를 node1 에 예약할 수 있습니다.

12.2.5. 추가 리소스

Red Hat logoGithubRedditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 문서 정보

Red Hat을 사용하는 고객은 신뢰할 수 있는 콘텐츠가 포함된 제품과 서비스를 통해 혁신하고 목표를 달성할 수 있습니다.

보다 포괄적 수용을 위한 오픈 소스 용어 교체

Red Hat은 코드, 문서, 웹 속성에서 문제가 있는 언어를 교체하기 위해 최선을 다하고 있습니다. 자세한 내용은 다음을 참조하세요.Red Hat 블로그.

Red Hat 소개

Red Hat은 기업이 핵심 데이터 센터에서 네트워크 에지에 이르기까지 플랫폼과 환경 전반에서 더 쉽게 작업할 수 있도록 강화된 솔루션을 제공합니다.

© 2024 Red Hat, Inc.