9.4. 클러스터 노드의 Redfish BMC 베어 메탈 이벤트 구독

노드의 BMCEventSubscription CR(사용자 정의 리소스)을 생성하고 이벤트에 대한 HardwareEvent CR을 생성하고 BMC에 대한 Secret CR을 생성하여 클러스터의 노드에서 생성된 Redfish BMC 이벤트를 구독할 수 있습니다.

9.4.1. 베어 메탈 이벤트 구독

BMC(Baseboard Management Controller)를 구성하여 OpenShift Container Platform 클러스터에서 실행되는 서브스크립션 애플리케이션에 베어 메탈 이벤트를 보낼 수 있습니다. Redfish 베어 메탈 이벤트의 예로는 장치 온도 증가 또는 장치 제거가 포함됩니다. REST API를 사용하여 애플리케이션을 베어 메탈 이벤트에 서브스크립션합니다.

중요

Redfish를 지원하고 벤더 인터페이스가 redfish 또는 idrac-redfish 로 설정된 물리적 하드웨어에 대한 BMCEventSubscription CR(사용자 정의 리소스)만 생성할 수 있습니다.

참고

BMCEventSubscription CR을 사용하여 사전 정의된 Redfish 이벤트를 구독합니다. Redfish 표준에서는 특정 경고 및 임계값을 생성할 수 있는 옵션을 제공하지 않습니다. 예를 들어 인클로저의 온도가 40>-< Celsius를 초과하는 경우 경고 이벤트를 수신하려면 공급 업체의 권장 사항에 따라 이벤트를 수동으로 구성해야 합니다.

BMCEventSubscription CR을 사용하여 노드의 베어 메탈 이벤트를 구독하려면 다음 절차를 수행합니다.

사전 요구 사항

  • OpenShift CLI(oc)를 설치합니다.
  • cluster-admin 권한이 있는 사용자로 로그인합니다.
  • BMC의 사용자 이름과 암호를 가져옵니다.
  • 클러스터에 Redfish 지원 BMC(Baseboard Management Controller)를 사용하여 베어 메탈 노드를 배포하고 BMC에서 Redfish 이벤트를 활성화합니다.

    참고

    특정 하드웨어에서 Redfish 이벤트를 활성화하는 것은 이 정보의 범위를 벗어납니다. 특정 하드웨어에 대한 Redfish 이벤트 활성화에 대한 자세한 내용은 BMC 제조업체 설명서를 참조하십시오.

프로세스

  1. 다음 curl 명령을 실행하여 노드 하드웨어에 Redfish EventService 가 활성화되어 있는지 확인합니다.

    $ curl https://<bmc_ip_address>/redfish/v1/EventService --insecure -H 'Content-Type: application/json' -u "<bmc_username>:<password>"

    다음과 같습니다.

    bmc_ip_address
    Redfish 이벤트가 생성되는 BMC의 IP 주소입니다.

    출력 예

    {
       "@odata.context": "/redfish/v1/$metadata#EventService.EventService",
       "@odata.id": "/redfish/v1/EventService",
       "@odata.type": "#EventService.v1_0_2.EventService",
       "Actions": {
          "#EventService.SubmitTestEvent": {
             "EventType@Redfish.AllowableValues": ["StatusChange", "ResourceUpdated", "ResourceAdded", "ResourceRemoved", "Alert"],
             "target": "/redfish/v1/EventService/Actions/EventService.SubmitTestEvent"
          }
       },
       "DeliveryRetryAttempts": 3,
       "DeliveryRetryIntervalSeconds": 30,
       "Description": "Event Service represents the properties for the service",
       "EventTypesForSubscription": ["StatusChange", "ResourceUpdated", "ResourceAdded", "ResourceRemoved", "Alert"],
       "EventTypesForSubscription@odata.count": 5,
       "Id": "EventService",
       "Name": "Event Service",
       "ServiceEnabled": true,
       "Status": {
          "Health": "OK",
          "HealthRollup": "OK",
          "State": "Enabled"
       },
       "Subscriptions": {
          "@odata.id": "/redfish/v1/EventService/Subscriptions"
       }
    }

  2. 다음 명령을 실행하여 클러스터의 Bare Metal Event Relay 서비스 경로를 가져옵니다.

    $ oc get route -n openshift-bare-metal-events

    출력 예

    NAME            HOST/PORT   PATH                                                                    SERVICES                 PORT   TERMINATION   WILDCARD
    hw-event-proxy              hw-event-proxy-openshift-bare-metal-events.apps.compute-1.example.com   hw-event-proxy-service   9087   edge          None

  3. BMCEventSubscription 리소스를 생성하여 Redfish 이벤트를 구독합니다.

    1. 다음 YAML을 bmc_sub.yaml 파일에 저장합니다.

      apiVersion: metal3.io/v1alpha1
      kind: BMCEventSubscription
      metadata:
        name: sub-01
        namespace: openshift-machine-api
      spec:
         hostName: <hostname> 1
         destination: <proxy_service_url> 2
         context: ''
      1
      Redfish 이벤트가 생성되는 작업자 노드의 이름 또는 UUID를 지정합니다.
      2
      베어 메탈 이벤트 프록시 서비스를 지정합니다(예: https://hw-event-proxy-openshift-bare-metal-events.apps.compute-1.example.com/webhook ).
    2. BMCEventSubscription CR을 생성합니다.

      $ oc create -f bmc_sub.yaml
  4. 선택 사항: BMC 이벤트 서브스크립션을 삭제하려면 다음 명령을 실행합니다.

    $ oc delete -f bmc_sub.yaml
  5. 선택 사항: BMCEventSubscription CR을 생성하지 않고 Redfish 이벤트 서브스크립션을 수동으로 생성하려면 BMC 사용자 이름과 암호를 지정하여 다음 curl 명령을 실행합니다.

    $ curl -i -k -X POST -H "Content-Type: application/json"  -d '{"Destination": "https://<proxy_service_url>", "Protocol" : "Redfish", "EventTypes": ["Alert"], "Context": "root"}' -u <bmc_username>:<password> 'https://<bmc_ip_address>/redfish/v1/EventService/Subscriptions' –v

    다음과 같습니다.

    proxy_service_url
    베어 메탈 이벤트 프록시 서비스(예: https://hw-event-proxy-openshift-bare-metal-events.apps.compute-1.example.com/webhook )입니다.
    bmc_ip_address
    Redfish 이벤트가 생성되는 BMC의 IP 주소입니다.

    출력 예

    HTTP/1.1 201 Created
    Server: AMI MegaRAC Redfish Service
    Location: /redfish/v1/EventService/Subscriptions/1
    Allow: GET, POST
    Access-Control-Allow-Origin: *
    Access-Control-Expose-Headers: X-Auth-Token
    Access-Control-Allow-Headers: X-Auth-Token
    Access-Control-Allow-Credentials: true
    Cache-Control: no-cache, must-revalidate
    Link: <http://redfish.dmtf.org/schemas/v1/EventDestination.v1_6_0.json>; rel=describedby
    Link: <http://redfish.dmtf.org/schemas/v1/EventDestination.v1_6_0.json>
    Link: </redfish/v1/EventService/Subscriptions>; path=
    ETag: "1651135676"
    Content-Type: application/json; charset=UTF-8
    OData-Version: 4.0
    Content-Length: 614
    Date: Thu, 28 Apr 2022 08:47:57 GMT

9.4.2. curl을 사용하여 Redfish 베어 메탈 이벤트 서브스크립션 쿼리

일부 하드웨어 벤더는 Redfish 하드웨어 이벤트 서브스크립션의 양을 제한합니다. curl 을 사용하여 Redfish 이벤트 서브스크립션 수를 쿼리할 수 있습니다.

사전 요구 사항

  • BMC의 사용자 이름과 암호를 가져옵니다.
  • 클러스터에 Redfish 사용 BMC(Baseboard Management Controller)를 사용하여 베어 메탈 노드를 배포하고 BMC에서 Redfish 하드웨어 이벤트를 활성화합니다.

절차

  1. 다음 curl 명령을 실행하여 BMC의 현재 서브스크립션을 확인합니다.

    $ curl --globoff -H "Content-Type: application/json" -k -X GET --user <bmc_username>:<password> https://<bmc_ip_address>/redfish/v1/EventService/Subscriptions

    다음과 같습니다.

    bmc_ip_address
    Redfish 이벤트가 생성되는 BMC의 IP 주소입니다.

    출력 예

    % Total % Received % Xferd Average Speed Time Time Time Current
    Dload Upload Total Spent Left Speed
    100 435 100 435 0 0 399 0 0:00:01 0:00:01 --:--:-- 399
    {
      "@odata.context": "/redfish/v1/$metadata#EventDestinationCollection.EventDestinationCollection",
      "@odata.etag": ""
      1651137375 "",
      "@odata.id": "/redfish/v1/EventService/Subscriptions",
      "@odata.type": "#EventDestinationCollection.EventDestinationCollection",
      "Description": "Collection for Event Subscriptions",
      "Members": [
      {
        "@odata.id": "/redfish/v1/EventService/Subscriptions/1"
      }],
      "Members@odata.count": 1,
      "Name": "Event Subscriptions Collection"
    }

    이 예에서 단일 서브스크립션이 /redfish/v1/EventService/Subscriptions/1 로 구성되어 있습니다.

  2. 선택 사항: curl 을 사용하여 /redfish/v1/EventService/Subscriptions/1 서브스크립션을 제거하려면 BMC 사용자 이름과 암호를 지정하여 다음 명령을 실행합니다.

    $ curl --globoff -L -w "%{http_code} %{url_effective}\n" -k -u <bmc_username>:<password >-H "Content-Type: application/json" -d '{}' -X DELETE https://<bmc_ip_address>/redfish/v1/EventService/Subscriptions/1

    다음과 같습니다.

    bmc_ip_address
    Redfish 이벤트가 생성되는 BMC의 IP 주소입니다.

9.4.3. 베어 메탈 이벤트 및 Secret CR 생성

베어 메탈 이벤트 사용을 시작하려면 Redfish 하드웨어가 있는 호스트에 대한 HardwareEvent CR(사용자 정의 리소스)을 생성합니다. 하드웨어 이벤트 및 오류는 hw-event-proxy 로그에 보고됩니다.

사전 요구 사항

  • OpenShift Container Platform CLI(oc)를 설치했습니다.
  • cluster-admin 권한이 있는 사용자로 로그인했습니다.
  • 베어 메탈 이벤트 릴레이를 설치했습니다.
  • BMC Redfish 하드웨어에 대한 BMCEventSubscription CR을 생성했습니다.

절차

  1. HardwareEvent CR(사용자 정의 리소스)을 생성합니다.

    참고

    여러 HardwareEvent 리소스가 허용되지 않습니다.

    1. 다음 YAML을 hw-event.yaml 파일에 저장합니다.

      apiVersion: "event.redhat-cne.org/v1alpha1"
      kind: "HardwareEvent"
      metadata:
        name: "hardware-event"
      spec:
        nodeSelector:
          node-role.kubernetes.io/hw-event: "" 1
        logLevel: "debug" 2
        msgParserTimeout: "10" 3
      1
      필수 항목입니다. nodeSelector 필드를 사용하여 지정된 레이블이 있는 노드를 대상으로 지정합니다(예: node-role.kubernetes.io/hw-event: "" ).
      참고

      OpenShift Container Platform 4.13 이상에서는 베어 메탈 이벤트에 HTTP 전송을 사용할 때 HardwareEvent 리소스에서 spec.transportHost 필드를 설정할 필요가 없습니다. 베어 메탈 이벤트에 AMQP 전송을 사용하는 경우에만 transportHost 를 설정합니다.

      2
      선택 사항: 기본값은 debug 입니다. hw-event-proxy 로그에서 로그 수준을 설정합니다. 다음과 같은 로그 수준을 사용할 수 있습니다. fatal,error,warning,info,debug,trace.
      3
      선택 사항: Message Parser의 시간 초과 값을 밀리초로 설정합니다. 메시지 구문 분석 요청이 시간 초과 내에 응답하지 않으면 원래 하드웨어 이벤트 메시지가 클라우드 네이티브 이벤트 프레임워크에 전달됩니다. 기본값은 10입니다.
    2. 클러스터에 HardwareEvent CR을 적용합니다.

      $ oc create -f hardware-event.yaml
  2. 하드웨어 이벤트 프록시가 베어 메탈 호스트의 Redfish 메시지 레지스트리에 액세스할 수 있는 BMC 사용자 이름 및 암호 Secret CR을 생성합니다.

    1. hw-event-bmc-secret.yaml 파일에 다음 YAML을 저장합니다.

      apiVersion: v1
      kind: Secret
      metadata:
        name: redfish-basic-auth
      type: Opaque
      stringData: 1
        username: <bmc_username>
        password: <bmc_password>
        # BMC host DNS or IP address
        hostaddr: <bmc_host_ip_address>
      1
      stringData 아래에 다양한 항목의 일반 텍스트 값을 입력합니다.
    2. Secret CR을 생성합니다.

      $ oc create -f hw-event-bmc-secret.yaml