mirror of
https://github.com/intel/intel-device-plugins-for-kubernetes.git
synced 2025-06-03 03:59:37 +00:00
3.5 KiB
3.5 KiB
Build and test Intel FPGA device plugin for Kubernetes
Dependencies
You must install and set up the following FPGA plugin modules for correct operation:
Get source code:
$ mkdir -p $GOPATH/src/github.com/intel/
$ cd $GOPATH/src/github.com/intel/
$ git clone https://github.com/intel/intel-device-plugins-for-kubernetes.git
Build FPGA device plugin:
$ cd $GOPATH/src/github.com/intel/intel-device-plugins-for-kubernetes
$ make fpga_plugin
Verify kubelet socket exists in /var/lib/kubelet/device-plugins/ directory:
$ ls /var/lib/kubelet/device-plugins/kubelet.sock
/var/lib/kubelet/device-plugins/kubelet.sock
Choose mode for FPGA device plugin
You can run the FPGA device plugin in either afu or region mode.
Run FPGA device plugin in afu mode
- Run FPGA device plugin as administrator:
$ export NODE_NAME="<node name>" # if the node's name was overridden and differs from hostname
$ sudo -E $GOPATH/src/github.com/intel/intel-device-plugins-for-kubernetes/cmd/fpga_plugin/fpga_plugin -mode af -kubeconfig /var/run/kubernetes/admin.kubeconfig
FPGA device plugin started in af mode
device-plugin start server at: /var/lib/kubelet/device-plugins/intel-fpga-af-f7df405cbd7acf7222f144b0b93acd18.sock
device-plugin registered
- Check if FPGA device plugin is registered on master:
$ kubectl describe node <node name> | grep intel.com/fpga
intel.com/fpga-af-f7df405cbd7acf7222f144b0b93acd18: 1
intel.com/fpga-af-f7df405cbd7acf7222f144b0b93acd18: 1
Run FPGA device plugin in region mode
- Run FPGA device plugin as administrator:
$ export NODE_NAME="<node name>" # if the node's name was overridden and differs from hostname
$ sudo -E $GOPATH/src/github.com/intel/intel-device-plugins-for-kubernetes/cmd/fpga_plugin/fpga_plugin -mode region -kubeconfig /var/run/kubernetes/admin.kubeconfig
FPGA device plugin started in region mode
device-plugin start server at: /var/lib/kubelet/device-plugins/intel-fpga-region-ce48969398f05f33946d560708be108a.sock
device-plugin registered
- Check if FPGA device plugin is registered on master:
$ kubectl describe node <node name> | grep intel.com/fpga
intel.com/fpga-region-ce48969398f05f33946d560708be108a: 1
intel.com/fpga-region-ce48969398f05f33946d560708be108a: 1
Deploy FPGA device plugin as DaemonSet
-
To deploy the plugin in a production cluster, create a service account for the plugin:
$ kubectl create -f deployments/fpga_plugin/fpga_plugin_service_account.yaml serviceaccount/intel-fpga-plugin-controller created clusterrole.rbac.authorization.k8s.io/node-getter created clusterrolebinding.rbac.authorization.k8s.io/get-nodes created
-
Create the DaemonSet:
$ kubectl create -f deployments/fpga_plugin/fpga_plugin.yaml daemonset.apps/intel-fpga-plugin created
-
Build an image from sources:
$ make intel-fpga-plugin
This image launches
fpga_plugin
in theaf
mode by default.You can override the mode on a per-node basis using this annotation:
$ kubectl annotate node mynode "fpga.intel.com/device-plugin-mode=region"
To use your own container image, modify the
deployments/fpga_plugin/fpga_plugin.yaml
file.
Next steps
Continue with FPGA admission controller webhook.