Este contenido no está disponible en el idioma seleccionado.
Chapter 9. The Node Feature Discovery Operator
Learn about the Node Feature Discovery (NFD) Operator and how you can use it to expose node-level information by orchestrating Node Feature Discovery, a Kubernetes add-on for detecting hardware features and system configuration.
9.1. About the Node Feature Discovery Operator Copiar enlaceEnlace copiado en el portapapeles!
The Node Feature Discovery Operator (NFD) manages the detection of hardware features and configuration in a OpenShift Container Platform cluster by labeling the nodes with hardware-specific information. NFD labels the host with node-specific attributes, such as PCI cards, kernel, operating system version, and so on.
The NFD Operator can be found on the Operator Hub by searching for “Node Feature Discovery”.
9.2. Installing the Node Feature Discovery Operator Copiar enlaceEnlace copiado en el portapapeles!
The Node Feature Discovery (NFD) Operator orchestrates all resources needed to run the NFD daemon set. As a cluster administrator, you can install the NFD Operator using the OpenShift Container Platform CLI or the web console.
9.2.1. Installing the NFD Operator using the CLI Copiar enlaceEnlace copiado en el portapapeles!
As a cluster administrator, you can install the NFD Operator using the CLI.
Prerequisites
- An OpenShift Container Platform cluster
-
Install the OpenShift CLI ().
oc -
Log in as a user with privileges.
cluster-admin
Procedure
Create a namespace for the NFD Operator.
Create the following
custom resource (CR) that defines theNamespacenamespace, and then save the YAML in theopenshift-nfdfile:nfd-namespace.yamlapiVersion: v1 kind: Namespace metadata: name: openshift-nfdCreate the namespace by running the following command:
$ oc create -f nfd-namespace.yaml
Install the NFD Operator in the namespace you created in the previous step by creating the following objects:
Create the following
CR and save the YAML in theOperatorGroupfile:nfd-operatorgroup.yamlapiVersion: operators.coreos.com/v1 kind: OperatorGroup metadata: generateName: openshift-nfd- name: openshift-nfd namespace: openshift-nfd spec: targetNamespaces: - openshift-nfdCreate the
CR by running the following command:OperatorGroup$ oc create -f nfd-operatorgroup.yamlRun the following command to get the
value required for the next step.channel$ oc get packagemanifest nfd -n openshift-marketplace -o jsonpath='{.status.defaultChannel}'Example output
4.8Create the following
CR and save the YAML in theSubscriptionfile:nfd-sub.yamlExample Subscription
apiVersion: operators.coreos.com/v1alpha1 kind: Subscription metadata: name: nfd namespace: openshift-nfd spec: channel: "4.8" installPlanApproval: Automatic name: nfd source: redhat-operators sourceNamespace: openshift-marketplaceCreate the subscription object by running the following command:
$ oc create -f nfd-sub.yamlChange to the
project:openshift-nfd$ oc project openshift-nfd
Verification
To verify that the Operator deployment is successful, run:
$ oc get podsExample output
NAME READY STATUS RESTARTS AGE nfd-controller-manager-7f86ccfb58-vgr4x 2/2 Running 0 10mA successful deployment shows a
status.Running
9.2.2. Installing the NFD Operator using the web console Copiar enlaceEnlace copiado en el portapapeles!
As a cluster administrator, you can install the NFD Operator using the web console.
It is recommended to create the
Namespace
Procedure
-
In the OpenShift Container Platform web console, click Operators
OperatorHub. - Choose Node Feature Discovery from the list of available Operators, and then click Install.
- On the Install Operator page, select a specific namespace on the cluster, select the namespace created in the previous section, and then click Install.
Verification
To verify that the NFD Operator installed successfully:
-
Navigate to the Operators
Installed Operators page. Ensure that Node Feature Discovery is listed in the openshift-nfd project with a Status of InstallSucceeded.
NoteDuring installation an Operator might display a Failed status. If the installation later succeeds with an InstallSucceeded message, you can ignore the Failed message.
Troubleshooting
If the Operator does not appear as installed, troubleshoot further:
-
Navigate to the Operators
Installed Operators page and inspect the Operator Subscriptions and Install Plans tabs for any failure or errors under Status. -
Navigate to the Workloads
Pods page and check the logs for pods in the project.openshift-nfd
9.3. Using the Node Feature Discovery Operator Copiar enlaceEnlace copiado en el portapapeles!
The Node Feature Discovery (NFD) Operator orchestrates all resources needed to run the Node-Feature-Discovery daemon set by watching for a
NodeFeatureDiscovery
NodeFeatureDiscovery
namespace
image
imagePullPolicy
nfd-worker-conf
As a cluster administrator, you can create a
NodeFeatureDiscovery
9.3.1. Create a NodeFeatureDiscovery instance using the CLI Copiar enlaceEnlace copiado en el portapapeles!
As a cluster administrator, you can create a
NodeFeatureDiscovery
Prerequisites
- An OpenShift Container Platform cluster
-
Install the OpenShift CLI ().
oc -
Log in as a user with privileges.
cluster-admin - Install the NFD Operator.
Procedure
Create the following
Custom Resource (CR), and then save the YAML in theNodeFeatureDiscoveryfile:NodeFeatureDiscovery.yamlapiVersion: nfd.openshift.io/v1 kind: NodeFeatureDiscovery metadata: name: nfd-instance namespace: openshift-nfd spec: instance: "" # instance is empty by default operand: namespace: openshift-nfd image: quay.io/openshift/origin-node-feature-discovery:4.8 imagePullPolicy: Always workerConfig: configData: | #core: # labelWhiteList: # noPublish: false # sleepInterval: 60s # sources: [all] # klog: # addDirHeader: false # alsologtostderr: false # logBacktraceAt: # logtostderr: true # skipHeaders: false # stderrthreshold: 2 # v: 0 # vmodule: ## NOTE: the following options are not dynamically run-time configurable ## and require a nfd-worker restart to take effect after being changed # logDir: # logFile: # logFileMaxSize: 1800 # skipLogHeaders: false #sources: # cpu: # cpuid: ## NOTE: whitelist has priority over blacklist # attributeBlacklist: # - "BMI1" # - "BMI2" # - "CLMUL" # - "CMOV" # - "CX16" # - "ERMS" # - "F16C" # - "HTT" # - "LZCNT" # - "MMX" # - "MMXEXT" # - "NX" # - "POPCNT" # - "RDRAND" # - "RDSEED" # - "RDTSCP" # - "SGX" # - "SSE" # - "SSE2" # - "SSE3" # - "SSE4.1" # - "SSE4.2" # - "SSSE3" # attributeWhitelist: # kernel: # kconfigFile: "/path/to/kconfig" # configOpts: # - "NO_HZ" # - "X86" # - "DMI" # pci: # deviceClassWhitelist: # - "0200" # - "03" # - "12" # deviceLabelFields: # - "class" # - "vendor" # - "device" # - "subsystem_vendor" # - "subsystem_device" # usb: # deviceClassWhitelist: # - "0e" # - "ef" # - "fe" # - "ff" # deviceLabelFields: # - "class" # - "vendor" # - "device" # custom: # - name: "my.kernel.feature" # matchOn: # - loadedKMod: ["example_kmod1", "example_kmod2"] # - name: "my.pci.feature" # matchOn: # - pciId: # class: ["0200"] # vendor: ["15b3"] # device: ["1014", "1017"] # - pciId : # vendor: ["8086"] # device: ["1000", "1100"] # - name: "my.usb.feature" # matchOn: # - usbId: # class: ["ff"] # vendor: ["03e7"] # device: ["2485"] # - usbId: # class: ["fe"] # vendor: ["1a6e"] # device: ["089a"] # - name: "my.combined.feature" # matchOn: # - pciId: # vendor: ["15b3"] # device: ["1014", "1017"] # loadedKMod : ["vendor_kmod1", "vendor_kmod2"] customConfig: configData: | # - name: "more.kernel.features" # matchOn: # - loadedKMod: ["example_kmod3"] # - name: "more.features.by.nodename" # value: customValue # matchOn: # - nodename: ["special-.*-node-.*"]Create the
CR instance by running the following command:NodeFeatureDiscovery$ oc create -f NodeFeatureDiscovery.yaml
Verification
To verify that the instance is created, run:
$ oc get podsExample output
NAME READY STATUS RESTARTS AGE nfd-controller-manager-7f86ccfb58-vgr4x 2/2 Running 0 11m nfd-master-hcn64 1/1 Running 0 60s nfd-master-lnnxx 1/1 Running 0 60s nfd-master-mp6hr 1/1 Running 0 60s nfd-worker-vgcz9 1/1 Running 0 60s nfd-worker-xqbws 1/1 Running 0 60sA successful deployment shows a
status.Running
9.3.2. Create a NodeFeatureDiscovery CR using the web console Copiar enlaceEnlace copiado en el portapapeles!
Procedure
-
Navigate to the Operators
Installed Operators page. - Find Node Feature Discovery and see a box under Provided APIs.
- Click Create instance.
-
Edit the values of the CR.
NodeFeatureDiscovery - Click Create.
9.4. Configuring the Node Feature Discovery Operator Copiar enlaceEnlace copiado en el portapapeles!
9.4.1. core Copiar enlaceEnlace copiado en el portapapeles!
The
core
core.sleepInterval
core.sleepInterval
This value is overridden by the deprecated
--sleep-interval
Example usage
core:
sleepInterval: 60s
The default value is
60s
core.sources
core.sources
all
This value is overridden by the deprecated
--sources
Default:
[all]
Example usage
core:
sources:
- system
- custom
core.labelWhiteList
core.labelWhiteList
The regular expression is only matched against the basename part of the label, the part of the name after '/'. The label prefix, or namespace, is omitted.
This value is overridden by the deprecated
--label-whitelist
Default:
null
Example usage
core:
labelWhiteList: '^cpu-cpuid'
core.noPublish
Setting
core.noPublish
true
nfd-master
nfd-worker
nfd-master
This value is overridden by the
--no-publish
Example:
Example usage
core:
noPublish: true
The default value is
false
core.klog
The following options specify the logger configuration, most of which can be dynamically adjusted at run-time.
The logger options can also be specified using command line flags, which take precedence over any corresponding config file options.
core.klog.addDirHeader
If set to
true
core.klog.addDirHeader
Default:
false
Run-time configurable: yes
core.klog.alsologtostderr
Log to standard error as well as files.
Default:
false
Run-time configurable: yes
core.klog.logBacktraceAt
When logging hits line file:N, emit a stack trace.
Default: empty
Run-time configurable: yes
core.klog.logDir
If non-empty, write log files in this directory.
Default: empty
Run-time configurable: no
core.klog.logFile
If not empty, use this log file.
Default: empty
Run-time configurable: no
core.klog.logFileMaxSize
core.klog.logFileMaxSize
0
Default:
1800
Run-time configurable: no
core.klog.logtostderr
Log to standard error instead of files
Default:
true
Run-time configurable: yes
core.klog.skipHeaders
If
core.klog.skipHeaders
true
Default:
false
Run-time configurable: yes
core.klog.skipLogHeaders
If
core.klog.skipLogHeaders
true
Default:
false
Run-time configurable: no
core.klog.stderrthreshold
Logs at or above this threshold go to stderr.
Default:
2
Run-time configurable: yes
core.klog.v
core.klog.v
Default:
0
Run-time configurable: yes
core.klog.vmodule
core.klog.vmodule
pattern=N
Default: empty
Run-time configurable: yes
9.4.2. sources Copiar enlaceEnlace copiado en el portapapeles!
The
sources
sources.cpu.cpuid.attributeBlacklist
Prevent publishing
cpuid
This value is overridden by
sources.cpu.cpuid.attributeWhitelist
Default:
[BMI1, BMI2, CLMUL, CMOV, CX16, ERMS, F16C, HTT, LZCNT, MMX, MMXEXT, NX, POPCNT, RDRAND, RDSEED, RDTSCP, SGX, SGXLC, SSE, SSE2, SSE3, SSE4.1, SSE4.2, SSSE3]
Example usage
sources:
cpu:
cpuid:
attributeBlacklist: [MMX, MMXEXT]
sources.cpu.cpuid.attributeWhitelist
Only publish the
cpuid
sources.cpu.cpuid.attributeWhitelist
sources.cpu.cpuid.attributeBlacklist
Default: empty
Example usage
sources:
cpu:
cpuid:
attributeWhitelist: [AVX512BW, AVX512CD, AVX512DQ, AVX512F, AVX512VL]
sources.kernel.kconfigFile
sources.kernel.kconfigFile
Default: empty
Example usage
sources:
kernel:
kconfigFile: "/path/to/kconfig"
sources.kernel.configOpts
sources.kernel.configOpts
Default:
[NO_HZ, NO_HZ_IDLE, NO_HZ_FULL, PREEMPT]
Example usage
sources:
kernel:
configOpts: [NO_HZ, X86, DMI]
sources.pci.deviceClassWhitelist
sources.pci.deviceClassWhitelist
03
0300
deviceLabelFields
Default:
["03", "0b40", "12"]
Example usage
sources:
pci:
deviceClassWhitelist: ["0200", "03"]
sources.pci.deviceLabelFields
sources.pci.deviceLabelFields
class
vendor
device
subsystem_vendor
subsystem_device
Default:
[class, vendor]
Example usage
sources:
pci:
deviceLabelFields: [class, vendor, device]
With the example config above, NFD would publish labels such as
feature.node.kubernetes.io/pci-<class-id>_<vendor-id>_<device-id>.present=true
sources.usb.deviceClassWhitelist
sources.usb.deviceClassWhitelist
deviceLabelFields
Default:
["0e", "ef", "fe", "ff"]
Example usage
sources:
usb:
deviceClassWhitelist: ["ef", "ff"]
sources.usb.deviceLabelFields
sources.usb.deviceLabelFields
class
vendor
device
Default:
[class, vendor, device]
Example usage
sources:
pci:
deviceLabelFields: [class, vendor]
With the example config above, NFD would publish labels like:
feature.node.kubernetes.io/usb-<class-id>_<vendor-id>.present=true
sources.custom
sources.custom
Default: empty
Example usage
source:
custom:
- name: "my.custom.feature"
matchOn:
- loadedKMod: ["e1000e"]
- pciId:
class: ["0200"]
vendor: ["8086"]