</span></code></pre></div></div></li></ol><h3id="deployment-templates">Deployment Templates</h3><p>The template specs provided in the repo can be used directly:</p><divclass="language-bash highlighter-rouge notranslate"><divclass="highlight"><preclass="highlight"><code>kubectl apply <spanclass="nt">-f</span> https://raw.githubusercontent.com/kubernetes-sigs/node-feature-discovery/master/nfd-master.yaml.template
</code></pre></div></div><p>This will required RBAC rules and deploy nfd-master (as a deployment) and nfd-worker (as a daemonset) in the <codeclass="language-plaintext highlighter-rouge notranslate">node-feature-discovery</code> namespace.</p><p>Alternatively you can download the templates and customize the deployment manually.</p><h4id="master-worker-pod">Master-Worker Pod</h4><p>You can also run nfd-master and nfd-worker inside the same pod</p><divclass="language-bash highlighter-rouge notranslate"><divclass="highlight"><preclass="highlight"><code>kubectl apply <spanclass="nt">-f</span> https://raw.githubusercontent.com/kubernetes-sigs/node-feature-discovery/master/nfd-daemonset-combined.yaml.template
</code></pre></div></div><p>This creates a DaemonSet runs both nfd-worker and nfd-master in the same Pod. In this case no nfd-master is run on the master node(s), but, the worker nodes are able to label themselves which may be desirable e.g. in single-node setups.</p><h4id="worker-one-shot">Worker One-shot</h4><p>Feature discovery can alternatively be configured as a one-shot job. The Job template may be used to achieve this:</p><divclass="language-bash highlighter-rouge notranslate"><divclass="highlight"><preclass="highlight"><code><spanclass="nv">NUM_NODES</span><spanclass="o">=</span><spanclass="si">$(</span>kubectl get no <spanclass="nt">-o</span><spanclass="nv">jsonpath</span><spanclass="o">=</span><spanclass="s1">'{.items[*].metadata.name}'</span> | <spanclass="nb">wc</span><spanclass="nt">-w</span><spanclass="si">)</span>
</code></pre></div></div><p>The example above launces as many jobs as there are non-master nodes. Note that this approach does not guarantee running once on every node. For example, tainted, non-ready nodes or some other reasons in Job scheduling may cause some node(s) will run extra job instance(s) to satisfy the request.</p><h3id="build-your-own">Build Your Own</h3><p>If you want to use the latest development version (master branch) you need to build your own custom image. See the <ahref="../advanced/developer-guide">Developer Guide</a> for instructions how to build images and deploy them on your cluster.</p><h2id="usage">Usage</h2><h3id="nfd-master">NFD-Master</h3><p>NFD-Master runs as a deployment (with a replica count of 1), by default it prefers running on the cluster's master nodes but will run on worker nodes if no master nodes are found.</p><p>For High Availability, you should simply increase the replica count of the deployment object. You should also look into adding <ahref="https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity">inter-pod</a> affinity to prevent masters from running on the same node. However note that inter-pod affinity is costly and is not recommended in bigger clusters.</p><p>NFD-Master listens for connections from nfd-worker(s) and connects to the Kubernetes API server to add node labels advertised by them.</p><p>If you have RBAC authorization enabled (as is the default e.g. with clusters initialized with kubeadm) you need to configure the appropriate ClusterRoles, ClusterRoleBindings and a ServiceAccount in order for NFD to create node labels. The provided template will configure these for you.</p><h3id="nfd-worker">NFD-Worker</h3><p>NFD-Worker is preferably run as a Kubernetes DaemonSet. This assures re-labeling on regular intervals capturing changes in the system configuration and mames sure that new nodes are labeled as they are added to the cluster. Worker connects to the nfd-master service to advertise hardware features.</p><p>When run as a daemonset, nodes are re-labeled at an interval specified using the <codeclass="language-plaintext highlighter-rouge notranslate">--sleep-interval</code> option. In the <ahref="https://github.com/kubernetes-sigs/node-feature-discovery/blob/master/nfd-worker-daemonset.yaml.template#L26">template</a> the default interval is set to 60s which is also the default when no <codeclass="language-plaintext highlighter-rouge notranslate">--sleep-interval</code> is specified. Also, the configuration file is re-read on each iteration providing a simple mechanism of run-time reconfiguration.</p><h3id="tls-authentication">TLS authentication</h3><p>NFD supports mutual TLS authentication between the nfd-master and nfd-worker instances. That is, nfd-worker and nfd-master both verify that the other end presents a valid certificate.</p><p>TLS authentication is enabled by specifying <codeclass="language-plaintext highlighter-rouge notranslate">--ca-file</code>, <codeclass="language-plaintext highlighter-rouge notranslate">--key-file</code> and <codeclass="language-plaintext highlighter-rouge notranslate">--cert-file</code> args, on both the nfd-master and nfd-worker instances. The template specs provided with NFD contain (commented out) example configuration for enabling TLS authentication.</p><p>The Common Name (CN) of the nfd-master certificate must match the DNS name of the nfd-master Service of the cluster. By default, nfd-master only check that the nfd-worker has been signed by the specified root certificate (–ca-file). Additional hardening can be enabled by specifying –verify-node-name in nfd-master args, in which case nfd-master verifies that the NodeName presented by nfd-worker matches the Common Name (CN) of its certificate. This means that each nfd-worker requires a individual node-specific TLS certificate.</p><h2id="configuration">Configuration</h2><p>NFD-Worker supports a configuration file. The default location is <codeclass="language-plaintext highlighter-rouge notranslate">/etc
</code></pre></div></div><p>The (empty-by-default) <ahref="https://github.com/kubernetes-sigs/node-feature-discovery/blob/master/nfd-worker.conf.example">example config</a> contains all available configuration options and can be used as a reference for creating creating a configuration.</p><p>Configuration options can also be specified via the <codeclass="language-plaintext highlighter-rouge notranslate">--options</code> command line flag, in which case no mounts need to be used. The same format as in the config file must be used, i.e. JSON (or YAML). For example:</p><divclass="language-plaintext highlighter-rouge notranslate"><divclass="highlight"><preclass="highlight"><code>--options='{"sources": { "pci": { "deviceClassWhitelist": ["12"] } } }'
</code></pre></div></div><p>Configuration options specified from the command line will override those read from the config file.</p><h2id="using-node-labels">Using Node Labels</h2><p>Nodes with specific features can be targeted using the <codeclass="language-plaintext highlighter-rouge notranslate">nodeSelector</code> field. The following example shows how to target nodes with Intel TurboBoost enabled.</p><divclass="language-yaml highlighter-rouge notranslate"><divclass="highlight"><preclass="highlight"><code><spanclass="na">apiVersion</span><spanclass="pi">:</span><spanclass="s">v1</span>
</code></pre></div></div><p>For more details on targeting nodes, see <ahref="https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/">node selection</a>.</p><h2id="uninstallation">Uninstallation</h2><h3id="operator-was-used-for-deployment">Operator Was Used for Deployment</h3><p>If you followed the deployment instructions above you can simply do:</p><divclass="language-bash highlighter-rouge notranslate"><divclass="highlight"><preclass="highlight"><code>kubectl <spanclass="nt">-n</span> nfd delete NodeFeatureDiscovery my-nfd-deployment
</code></pre></div></div><p>Optionally, you can also remove the namespace:</p><divclass="language-bash highlighter-rouge notranslate"><divclass="highlight"><preclass="highlight"><code>kubectl delete ns nfd
</code></pre></div></div><p>See the <ahref="https://github.com/kubernetes-sigs/node-feature-discovery-operator">node-feature-discovery-operator</a> and <ahref="https://github.com/operator-framework/operator-lifecycle-manager">OLM</a> project documentation for instructions for uninstalling the operator and operator lifecycle manager, respectively.</p><h3id="manual">Manual</h3><divclass="language-bash highlighter-rouge notranslate"><divclass="highlight"><preclass="highlight"><code><spanclass="nv">NFD_NS</span><spanclass="o">=</span>node-feature-discovery
kubectl <spanclass="nt">-n</span><spanclass="nv">$NFD_NS</span> delete sa nfd-master
kubectl delete clusterrole nfd-master
kubectl delete clusterrolebinding nfd-master
</code></pre></div></div><h3id="removing-feature-labels">Removing Feature Labels</h3><p>NFD-Master has a special <codeclass="language-plaintext highlighter-rouge notranslate">--prune</code> command line flag for removing all nfd-related node labels, annotations and extended resources from the cluster.</p><divclass="language-bash highlighter-rouge notranslate"><divclass="highlight"><preclass="highlight"><code>kubectl apply <spanclass="nt">-f</span> https://raw.githubusercontent.com/kubernetes-sigs/node-feature-discovery/master/nfd-prune.yaml.template
</code></pre></div></div><p><strong>NOTE:</strong> You must run prune before removing the RBAC rules (serviceaccount, clusterrole and clusterrolebinding).</p><!-- Links --></div></div><divclass="navigation-bottom d-flex flex-justify-between py-3"role="navigation"aria-label="footer navigation"><divclass="prev"><ahref="/node-feature-discovery/master/get-started/quick-start.html"class="btn"title="Quick Start"accesskey="p"rel="prev"><iclass="fa fa-arrow-circle-left"></i> Previous </a></div><divclass="next"><ahref="/node-feature-discovery/master/get-started/features.html"class="btn"title="Feature Discovery"accesskey="n"rel="next"> Next <iclass="fa fa-arrow-circle-right"></i></a></div></div><hr><divclass="copyright text-center text-gray"role="contentinfo"><iclass="fa fa-copyright"></i><spanclass="time">2016-2020,</span><aclass="text-gray"href="https://github.com/kubernetes-sigs"rel="noreferrer"target="_blank">Kubernetes SIGs</a> Revision <aclass="text-gray"href="https://github.com/kubernetes-sigs/node-feature-discovery/commit/"title=""rel="noreferrer"target="_blank"></a><br><divclass="generator"> Built with <ahref="https://jekyllrb.com"rel="noreferrer"target="_blank">Jekyll</a> using a <ahref="https://github.com/rundocs/jekyll-rtd-theme"rel="noreferrer"target="_blank"title="remote theme: jekyll-rtd-theme v2.0.9">theme</a> provided by <ahref="https://rundocs.io"rel="noreferrer"target="_blank">RunDocs</a>. </div></div></div></div><divclass="addons-wrap d-flex flex-column overflow-y-auto"><divclass="status d-flex flex-justify-between p-2"><divclass="title p-1"><iclass="fa fa-book"></i> Node Feature Discovery </div><divclass="branch p-1"><spanclass="name"> master </span><iclass="fa fa-caret-down"></i></div></div><divclass="addons d-flex flex-column height-full p-2 d-none"><dlid="versions"><dt>Versions</dt><scriptsrc="/node-feature-discovery/versions.js"></script><script>vardt=document.getElementById('versions');varitems=getVersionListItems();for(vari=0;i<items.length;i++){vardd=document.createElement('dd');vara=dd.appendChild(document.createElement('a'));a.appendChild(document.createTextNode(items[i].name));a.href=items[i].url;dt.appendChild(dd);}</script></dl><dl><dt>GitHub</dt><dd><ahref="https://github.com/kubernetes-sigs/node-feature-discovery"title="Stars: 234"><iclass="fa fa-github"></i> Homepage </a></dd><dd><ahref="https://github.com/kubernetes-sigs/node-feature-discovery/issues"title="Open issues: 12"><iclass="fa fa-question-circle-o"></i> Issues </a></dd><dd><ahref="https://github.com/kubernetes-sigs/node-feature-discovery/zipball/gh-pages"title="Size: 78611 Kb"><iclass="fa fa-download"></i> Download </a></dd></dl><hr><divclass="license f6 pb-2"> The <ahref="/node-feature-discovery/master/">software</a> is under the terms of <ahref="https://github.com/kubernetes-sigs/node-feature-discovery">Apache License 2.0</a>. </div></div></div><script>window.ui={title:"Node Feature Discovery",baseurl:"/node-feature-discovery/master",i18n:{search_results:"Search Results",search_results_found:"Search finished, found # page(s) matching the search query.",search_results_not_found:"Your search did not match any documents, please make sure that all characters are spelled correctly!"}};</script><scriptsrc="https://cdn.jsdelivr.net/gh/rundocs/jekyll-rtd-theme@2.0.9/assets/js/jquery.min.js"></script><scriptsrc="https://cdn.jsdelivr.net/gh/rundocs/jekyll-rtd-theme@2.0.9/assets/js/theme.min.js"></script></body></html>