24.4. 노드 관찰 연산자 스크립팅


스크립팅을 사용하면 현재의 Node Observability Operator와 Node Observability Agent를 사용하여 미리 구성된 bash 스크립트를 실행할 수 있습니다.

이러한 스크립트는 CPU 부하, 메모리 부족, 워커 노드 문제와 같은 주요 지표를 모니터링합니다. 또한 SAR 보고서와 맞춤형 성과 지표도 수집합니다.

24.4.1. 스크립팅을 위한 Node Observability 사용자 정의 리소스 생성

스크립팅을 실행하기 전에 NodeObservability 사용자 정의 리소스(CR)를 만들고 실행해야 합니다. NodeObservability CR을 실행하면 nodeSelector 레이블과 일치하는 컴퓨팅 노드에서 스크립팅 모드로 에이전트가 활성화됩니다.

사전 요구 사항

  • 노드 관찰 연산자를 설치했습니다.
  • OpenShift CLI(oc)가 설치되어 있습니다.
  • cluster-admin 권한이 있는 클러스터에 액세스할 수 있습니다.

프로세스

  1. 다음 명령을 실행하여 OpenShift Container Platform 클러스터에 로그인합니다.

    $ oc login -u kubeadmin https://<host_name>:6443
  2. 다음 명령을 실행하여 node-observability-operator 네임스페이스로 전환합니다.

    $ oc project node-observability-operator
  3. 다음 내용을 포함하는 nodeobservability.yaml 이라는 파일을 만듭니다.

        apiVersion: nodeobservability.olm.openshift.io/v1alpha2
        kind: NodeObservability
        metadata:
          name: cluster 
    1
    
        spec:
          nodeSelector:
            kubernetes.io/hostname: <node_hostname> 
    2
    
          type: scripting 
    3
    1
    클러스터당 NodeObservability CR은 하나만 있어야 하므로 이름을 cluster 로 지정해야 합니다.
    2
    노드 관찰 에이전트를 배포해야 하는 노드를 지정합니다.
    3
    에이전트를 스크립팅 모드로 배포하려면 유형을 스크립팅 으로 설정해야 합니다.
  4. 다음 명령을 실행하여 NodeObservability CR을 만듭니다.

    $ oc apply -f nodeobservability.yaml

    출력 예

    nodeobservability.olm.openshift.io/cluster created

  5. 다음 명령을 실행하여 NodeObservability CR의 상태를 검토하세요.

    $ oc get nob/cluster -o yaml | yq '.status.conditions'

    출력 예

    conditions:
      conditions:
      - lastTransitionTime: "2022-07-05T07:33:54Z"
        message: 'DaemonSet node-observability-ds ready: true NodeObservabilityScripting
          ready: true'
        reason: Ready
        status: "True"
        type: Ready

    NodeObservability CR 실행은 이유가 준비 이고 상태가 "참" 일 때 완료됩니다.

24.4.2. 노드 Observability Operator 스크립팅 구성

사전 요구 사항

  • 노드 관찰 연산자를 설치했습니다.
  • NodeObservability 사용자 정의 리소스(CR)를 생성했습니다.
  • cluster-admin 권한이 있는 클러스터에 액세스할 수 있습니다.

프로세스

  1. 다음 내용을 포함하는 nodeobservabilityrun-script.yaml 이라는 파일을 만듭니다.

    apiVersion: nodeobservability.olm.openshift.io/v1alpha2
    kind: NodeObservabilityRun
    metadata:
      name: nodeobservabilityrun-script
      namespace: node-observability-operator
    spec:
      nodeObservabilityRef:
        name: cluster
        type: scripting
    중요

    다음 스크립트만 요청할 수 있습니다.

    • metrics.sh
    • network-metrics.sh ( monitor.sh 사용)
  2. 다음 명령으로 NodeObservabilityRun 리소스를 만들어 스크립팅을 트리거합니다.

    $ oc apply -f nodeobservabilityrun-script.yaml
  3. 다음 명령을 실행하여 NodeObservabilityRun 스크립팅의 상태를 검토하세요.

    $ oc get nodeobservabilityrun nodeobservabilityrun-script -o yaml  | yq '.status.conditions'

    출력 예

    Status:
      Agents:
        Ip:    10.128.2.252
        Name:  node-observability-agent-n2fpm
        Port:  8443
        Ip:    10.131.0.186
        Name:  node-observability-agent-wcc8p
        Port:  8443
      Conditions:
        Conditions:
          Last Transition Time:  2023-12-19T15:10:51Z
          Message:               Ready to start profiling
          Reason:                Ready
          Status:                True
          Type:                  Ready
          Last Transition Time:  2023-12-19T15:11:01Z
          Message:               Profiling query done
          Reason:                Finished
          Status:                True
          Type:                  Finished
      Finished Timestamp:        2023-12-19T15:11:01Z
      Start Timestamp:           2023-12-19T15:10:51Z

    상태True 이고 유형Finished 이면 스크립팅이 완료됩니다.

  4. 다음 bash 스크립트를 실행하여 컨테이너의 루트 경로에서 스크립팅 데이터를 검색합니다.

    #!/bin/bash
    
    RUN=$(oc get nodeobservabilityrun --no-headers | awk '{print $1}')
    
    for a in $(oc get nodeobservabilityruns.nodeobservability.olm.openshift.io/${RUN} -o json | jq .status.agents[].name); do
      echo "agent ${a}"
      agent=$(echo ${a} | tr -d "\"\'\`")
      base_dir=$(oc exec "${agent}" -c node-observability-agent -- bash -c "ls -t | grep node-observability-agent" | head -1)
      echo "${base_dir}"
      mkdir -p "/tmp/${agent}"
      for p in $(oc exec "${agent}" -c node-observability-agent -- bash -c "ls ${base_dir}"); do
        f="/${base_dir}/${p}"
        echo "copying ${f} to /tmp/${agent}/${p}"
        oc exec "${agent}" -c node-observability-agent -- cat ${f} > "/tmp/${agent}/${p}"
      done
    done
Red Hat logoGithubredditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 문서 정보

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

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

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

Red Hat 소개

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

Theme

© 2026 Red Hat
맨 위로 이동