// Module included in the following assemblies:
//
// * hardware_enablement/psap-node-feature-discovery-operator.adoc

:_mod-docs-content-type: PROCEDURE
[id="creating-nfd-cr-cli_{context}"]
= Creating a NodeFeatureDiscovery CR by using the CLI

As a cluster administrator, you can create a `NodeFeatureDiscovery` CR instance by using the {oc-first}.

[NOTE]
====
The `spec.operand.image` setting requires a `-rhel9` image to be defined for use with {product-title} releases 4.13 and later.
====

The following example shows the use of `-rhel9` to acquire the correct image.

.Prerequisites

* You have access to an {product-title} cluster
* You installed the {oc-first}.
* You logged in as a user with `cluster-admin` privileges.
* You installed the NFD Operator.

.Procedure

. Create a `NodeFeatureDiscovery` CR:
+
.Example `NodeFeatureDiscovery` CR
[source,yaml,subs="attributes+"]
----
apiVersion: nfd.openshift.io/v1
kind: NodeFeatureDiscovery
metadata:
  name: nfd-instance
  namespace: openshift-nfd
spec:
  instance: "" # instance is empty by default
  topologyupdater: false # False by default
  operand:
    image: registry.redhat.io/openshift4/ose-node-feature-discovery-rhel9:v{product-version} <1>
    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"
  customConfig:
    configData: |
          - name: "more.kernel.features"
            matchOn:
            - loadedKMod: ["example_kmod3"]
----
<1> The `operand.image` field is mandatory.

. Create the `NodeFeatureDiscovery` CR by running the following command:
+
[source,terminal]
----
$ oc apply -f <filename>
----

.Verification

. Check that the `NodeFeatureDiscovery` CR was created by running the following command:
+
[source,terminal]
----
$ oc get pods
----
+
.Example output
[source,terminal]
----
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          60s
----
+
A successful deployment shows a `Running` status.
