4.6. 장치 플러그인 이해

장치 플러그인은 클러스터 전체에서 하드웨어 장치를 소비할 수 있는 일관되고 이식 가능한 솔루션을 제공합니다. 장치 플러그인은 확장 메커니즘을 통해 이러한 장치를 지원하여 컨테이너에서 이러한 장치를 사용할 수있게 하고 장치의 상태 점검을 제공하며 안전하게 공유합니다.

중요

OpenShift Container Platform은 장치 플러그인 API를 지원하지만 장치 플러그인 컨테이너는 개별 공급 업체에 의해 지원됩니다.

장치 플러그인은 특정 하드웨어 리소스를 관리하는 노드 (kubelet 외부)에서 실행되는 gRPC 서비스입니다. 모든 장치 플러그인은 다음 원격 프로 시저 호출 (RPC)을 지원해야합니다.

service DevicePlugin {
      // GetDevicePluginOptions returns options to be communicated with Device
      // Manager
      rpc GetDevicePluginOptions(Empty) returns (DevicePluginOptions) {}

      // ListAndWatch returns a stream of List of Devices
      // Whenever a Device state change or a Device disappears, ListAndWatch
      // returns the new list
      rpc ListAndWatch(Empty) returns (stream ListAndWatchResponse) {}

      // Allocate is called during container creation so that the Device
      // Plug-in can run device specific operations and instruct Kubelet
      // of the steps to make the Device available in the container
      rpc Allocate(AllocateRequest) returns (AllocateResponse) {}

      // PreStartcontainer is called, if indicated by Device Plug-in during
      // registration phase, before each container start. Device plug-in
      // can run device specific operations such as reseting the device
      // before making devices available to the container
      rpc PreStartcontainer(PreStartcontainerRequest) returns (PreStartcontainerResponse) {}
}
장치 플러그인의 예
참고

간편한 장치 플러그인 참조 구현을 위해 장치 관리자 (Device Manager) 코드에 vendor/k8s.io/kubernetes/pkg/kubelet/cm/deviceplugin/device_plugin_stub.go 스텁 장치 플러그인을 사용할 수 있습니다.

4.6.1. 장치 플러그인을 배포하는 방법

  • 장치 플러그인 배포에는 데몬 세트 접근 방식을 사용하는 것이 좋습니다.
  • 시작할 때 장치 플러그인은 노드의 /var/lib/kubelet/device-plugin/에 UNIX 도메인 소켓을 만들어 장치 관리자의 RPC를 제공하려고 합니다.
  • 장치 플러그인은 하드웨어 리소스, 호스트 파일 시스템에 대한 액세스 및 소켓 생성을 관리해야 하므로 권한이 부여된 보안 컨텍스트에서 실행해야합니다.
  • 배포 단계에 대한 보다 구체적인 세부 사항은 각 장치 플러그인 구현에서 확인할 수 있습니다.