1
0
Fork 0
mirror of https://github.com/kubernetes-sigs/node-feature-discovery.git synced 2025-03-05 08:17:04 +00:00
node-feature-discovery/master/developer-guide/index.html
Github Actions ec30cf4369 Update documentation for master
Auto-generated from v0.17.0-devel-199-gc4bf016f by 'update-gh-pages.sh'
2024-10-30 10:24:40 +00:00

30 lines
No EOL
34 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html> <html lang="en" dir="auto"> <head><meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=5, user-scalable=no"> <meta name="description" content="Developer guide Table of contents Building from source Download the source code Docker build Docker multi-arch builds with buildx Deployment Buildi..."> <meta name="revised" content=""> <meta name="author" content="Kubernetes SIGs"> <meta name="generator" content="jekyll-rtd-theme v2.0.10"><meta name="theme-color" content="#2980b9"> <title>Developer guide · Node Feature Discovery</title> <meta name="twitter:title" content="Developer guide · Node Feature Discovery"> <meta name="twitter:description" content="Developer guide Table of contents Building from source Download the source code Docker build Docker multi-arch builds with buildx Deployment Buildi..."> <meta name="twitter:card" content="summary"> <meta name="twitter:site" content="@Kubernetes SIGs"> <meta name="twitter:url" content="https://kubernetes-sigs.github.com/node-feature-discovery/master/developer-guide/"> <meta name="twitter:creator" content="@jekyll-rtd-theme v2.0.10"> <meta property="og:title" content="Developer guide · Node Feature Discovery"> <meta property="og:description" content="Developer guide Table of contents Building from source Download the source code Docker build Docker multi-arch builds with buildx Deployment Buildi..."> <meta property="og:locale" content="en"> <meta property="og:url" content="https://kubernetes-sigs.github.com/node-feature-discovery/master/developer-guide/"> <meta property="og:type" content="article"> <meta property="article:author" content="Kubernetes SIGs"> <meta property="article:published_time" content="2016-07-23T05:07:52+00:00"> <meta property="article:modified_time" content="2024-10-30T10:24:34+00:00"> <script type="application/ld+json"> { "@context": "https://schema.org", "@type": "Article", "mainEntityOfPage": { "@type": "WebPage", "@id": "https://kubernetes-sigs.github.com/node-feature-discovery/master/developer-guide/" }, "headline": "Developer guide · Node Feature Discovery", "image": [], "author": { "@type": "Person", "name": "Kubernetes SIGs" }, "datePublished": "2016-07-23T05:07:52+00:00", "dateModified": "2024-10-30T10:24:34+00:00", "publisher": { "@type": "Organization", "name": "Kubernetes SIGs", "logo": { "@type": "ImageObject", "url": "https://avatars.githubusercontent.com/u/36015203?v=4" } }, "description": "Developer guide Table of contents Building from source Download the source code Docker build Docker multi-arch builds with buildx Deployment Buildi..." } </script> <link rel="dns-prefetch" href="https://cdn.jsdelivr.net"><link rel="canonical" href="https://kubernetes-sigs.github.com/node-feature-discovery/master/developer-guide/"><link rel="icon" type="image/svg+xml" href="/node-feature-discovery/master/assets/images/favicon.svg"><link rel="icon" type="image/png" href="/node-feature-discovery/master/assets/images/favicon-16x16.png" sizes="16x16"> <link rel="icon" type="image/png" href="/node-feature-discovery/master/assets/images/favicon-32x32.png" sizes="32x32"> <link rel="icon" type="image/png" href="/node-feature-discovery/master/assets/images/favicon-96x96.png" sizes="96x96"><link rel="mask-icon" href="/node-feature-discovery/master/assets/images/favicon.svg" color="#2980b9"><link rel="apple-touch-icon" href="/node-feature-discovery/master/assets/images/apple-touch-icon-300x300.jpg"> <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/rundocs/jekyll-rtd-theme@2.0.10/assets/css/theme.min.css"><style>@media (min-width: 1280px){.content-wrap{max-width:1200px}}</style><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> </head> <body class="container"><div class="sidebar-wrap overflow-hidden"> <div class="sidebar height-full overflow-y-scroll overflow-x-hidden"> <div class="header d-flex flex-column p-3 text-center"> <div class="title pb-1"> <a class="h4 no-underline py-1 px-2 rounded-1" href="/node-feature-discovery/master/" title="Documentation of Node Feature Discovery - a Kubernetes add-on for discovering and advertising hardware features and system configuration in the cluster."> <i class="fa fa-home"></i> Node Feature Discovery </a> </div> <span class="version">master</span> <form class="search pt-2" action="/node-feature-discovery/master/search.html" method="get" autocomplete="off"> <input class="form-control input-block input-sm" type="text" name="q" placeholder="Search docs..."> </form> </div> <div class="toctree py-2" data-spy="affix" role="navigation" aria-label="main navigation"> <ul> </ul> <a class="caption d-block text-uppercase no-wrap px-2 py-0" href="/node-feature-discovery/master/get-started/"> Get started </a><ul> <li class="toc level-1 " data-sort="1" data-level="1"> <a class="d-flex flex-items-baseline " href="/node-feature-discovery/master/get-started/introduction.html">1. Introduction</a> </li> <li class="toc level-1 " data-sort="2" data-level="1"> <a class="d-flex flex-items-baseline " href="/node-feature-discovery/master/get-started/quick-start.html">2. Quick start</a> </li></ul> <a class="caption d-block text-uppercase no-wrap px-2 py-0" href="/node-feature-discovery/master/deployment/"> Deployment </a><ul> <li class="toc level-1 " data-sort="1" data-level="1"> <a class="d-flex flex-items-baseline " href="/node-feature-discovery/master/deployment/image-variants.html">1. Image variants</a> </li> <li class="toc level-1 " data-sort="2" data-level="1"> <a class="d-flex flex-items-baseline " href="/node-feature-discovery/master/deployment/kustomize.html">2. Kustomize</a> </li> <li class="toc level-1 " data-sort="3" data-level="1"> <a class="d-flex flex-items-baseline " href="/node-feature-discovery/master/deployment/helm.html">3. Helm</a> </li> <li class="toc level-1 " data-sort="4" data-level="1"> <a class="d-flex flex-items-baseline " href="/node-feature-discovery/master/deployment/operator.html">4. NFD Operator</a> </li> <li class="toc level-1 " data-sort="5" data-level="1"> <a class="d-flex flex-items-baseline " href="/node-feature-discovery/master/deployment/tls.html">5. TLS authentication</a> </li> <li class="toc level-1 " data-sort="6" data-level="1"> <a class="d-flex flex-items-baseline " href="/node-feature-discovery/master/deployment/uninstallation.html">6. Uninstallation</a> </li> <li class="toc level-1 " data-sort="7" data-level="1"> <a class="d-flex flex-items-baseline " href="/node-feature-discovery/master/deployment/metrics.html">7. Metrics</a> </li></ul> <a class="caption d-block text-uppercase no-wrap px-2 py-0" href="/node-feature-discovery/master/usage/"> Usage </a><ul> <li class="toc level-1 " data-sort="1" data-level="1"> <a class="d-flex flex-items-baseline " href="/node-feature-discovery/master/usage/features.html">1. Feature labels</a> </li> <li class="toc level-1 " data-sort="2" data-level="1"> <a class="d-flex flex-items-baseline " href="/node-feature-discovery/master/usage/using-labels.html">2. Using node labels</a> </li> <li class="toc level-1 " data-sort="3" data-level="1"> <a class="d-flex flex-items-baseline " href="/node-feature-discovery/master/usage/nfd-master.html">3. NFD-Master</a> </li> <li class="toc level-1 " data-sort="4" data-level="1"> <a class="d-flex flex-items-baseline " href="/node-feature-discovery/master/usage/nfd-worker.html">4. NFD-Worker</a> </li> <li class="toc level-1 " data-sort="5" data-level="1"> <a class="d-flex flex-items-baseline " href="/node-feature-discovery/master/usage/nfd-topology-updater.html">5. NFD-Topology-Updater</a> </li> <li class="toc level-1 " data-sort="6" data-level="1"> <a class="d-flex flex-items-baseline " href="/node-feature-discovery/master/usage/nfd-gc.html">6. NFD-Garbage-Collector</a> </li> <li class="toc level-1 " data-sort="7" data-level="1"> <a class="d-flex flex-items-baseline " href="/node-feature-discovery/master/usage/custom-resources.html">7. CRDs</a> </li> <li class="toc level-1 " data-sort="8" data-level="1"> <a class="d-flex flex-items-baseline " href="/node-feature-discovery/master/usage/customization-guide.html">8. Customization guide</a> </li> <li class="toc level-1 " data-sort="9" data-level="1"> <a class="d-flex flex-items-baseline " href="/node-feature-discovery/master/usage/examples-and-demos.html">9. Examples and demos</a> </li> <li class="toc level-1 " data-sort="10" data-level="1"> <a class="d-flex flex-items-baseline " href="/node-feature-discovery/master/usage/kubectl-plugin.html">10. Kubectl plugin</a> </li></ul> <a class="caption d-block text-uppercase no-wrap px-2 py-0" href="/node-feature-discovery/master/reference/"> Reference </a><ul> <li class="toc level-1 " data-sort="1" data-level="1"> <a class="d-flex flex-items-baseline " href="/node-feature-discovery/master/reference/master-commandline-reference.html">1. Master cmdline reference</a> </li> <li class="toc level-1 " data-sort="2" data-level="1"> <a class="d-flex flex-items-baseline " href="/node-feature-discovery/master/reference/worker-commandline-reference.html">2. Worker cmdline reference</a> </li> <li class="toc level-1 " data-sort="3" data-level="1"> <a class="d-flex flex-items-baseline " href="/node-feature-discovery/master/reference/master-configuration-reference.html">3. Master config reference</a> </li> <li class="toc level-1 " data-sort="4" data-level="1"> <a class="d-flex flex-items-baseline " href="/node-feature-discovery/master/reference/worker-configuration-reference.html">4. Worker config reference</a> </li> <li class="toc level-1 " data-sort="5" data-level="1"> <a class="d-flex flex-items-baseline " href="/node-feature-discovery/master/reference/topology-updater-commandline-reference.html">5. Topology Updater Cmdline Reference</a> </li> <li class="toc level-1 " data-sort="6" data-level="1"> <a class="d-flex flex-items-baseline " href="/node-feature-discovery/master/reference/topology-updater-configuration-reference.html">6. Topology-Updater config reference</a> </li> <li class="toc level-1 " data-sort="7" data-level="1"> <a class="d-flex flex-items-baseline " href="/node-feature-discovery/master/reference/gc-commandline-reference.html">7. Garbage Collector Cmdline Reference</a> </li> <li class="toc level-1 " data-sort="8" data-level="1"> <a class="d-flex flex-items-baseline " href="/node-feature-discovery/master/reference/plugin-commandline-reference.html">8. Kubectl plugin cmdline reference</a> </li> <li class="toc level-1 " data-sort="9" data-level="1"> <a class="d-flex flex-items-baseline " href="/node-feature-discovery/master/reference/versions.html">9. Versions</a> </li> <li class="toc level-1 " data-sort="10" data-level="1"> <a class="d-flex flex-items-baseline " href="/node-feature-discovery/master/reference/feature-gates.html">10. Feature Gates</a> </li></ul> <a class="caption d-block text-uppercase no-wrap px-2 py-0" href="/node-feature-discovery/master/developer-guide/"> Developer guide </a><ul> </ul> <a class="caption d-block text-uppercase no-wrap px-2 py-0" href="/node-feature-discovery/master/contributing/"> Contributing </a><ul> </ul> </div> </div> </div> <div class="content-wrap"> <div class="header d-flex flex-justify-between p-2 hide-lg hide-xl" aria-label="top navigation"> <button id="toggle" aria-label="Toggle menu" class="btn-octicon p-2 m-0 text-white" type="button"> <i class="fa fa-bars"></i> </button> <div class="title flex-1 d-flex flex-justify-center"> <a class="h4 no-underline py-1 px-2 rounded-1" href="/node-feature-discovery/master/">Node Feature Discovery</a> </div> </div> <div class="content p-3 p-sm-5"> <div class="navigation-top d-flex flex-justify-between"> <ul class="breadcrumb" role="navigation" aria-label="breadcrumbs navigation"> <li class="breadcrumb-item"> <a class="no-underline" href="/node-feature-discovery/master/" title="/"> <i class="fa fa-home"></i> </a> </li><li class="breadcrumb-item" ><a href="/node-feature-discovery/master/developer-guide/">developer-guide</a></li><li class="breadcrumb-item" aria-current="page">index.md</li></ul> <a class="edit" href="https://github.com/kubernetes-sigs/node-feature-discovery/edit/gh-pages/developer-guide/index.md" title="Edit on GitHub" rel="noreferrer" target="_blank"> <i class="fa fa-edit"></i> </a> </div> <hr> <div role="main" itemscope="itemscope" itemtype="https://schema.org/Article"> <div class="markdown-body" itemprop="articleBody"> <h1 class="no_toc" id="developer-guide">Developer guide</h1> <h2 class="no_toc text-delta" id="table-of-contents">Table of contents</h2> <ol id="markdown-toc"> <li><a href="#building-from-source" id="markdown-toc-building-from-source">Building from source</a> <ol> <li><a href="#download-the-source-code" id="markdown-toc-download-the-source-code">Download the source code</a></li> <li><a href="#docker-build" id="markdown-toc-docker-build">Docker build</a></li> <li><a href="#docker-multi-arch-builds-with-buildx" id="markdown-toc-docker-multi-arch-builds-with-buildx">Docker multi-arch builds with buildx</a></li> <li><a href="#deployment" id="markdown-toc-deployment">Deployment</a></li> <li><a href="#building-locally" id="markdown-toc-building-locally">Building locally</a></li> <li><a href="#customizing-the-build" id="markdown-toc-customizing-the-build">Customizing the build</a></li> <li><a href="#testing" id="markdown-toc-testing">Testing</a></li> </ol> </li> <li><a href="#running-locally" id="markdown-toc-running-locally">Running locally</a> <ol> <li><a href="#nfd-master" id="markdown-toc-nfd-master">NFD-Master</a></li> <li><a href="#nfd-worker" id="markdown-toc-nfd-worker">NFD-Worker</a></li> <li><a href="#nfd-topology-updater" id="markdown-toc-nfd-topology-updater">NFD-Topology-Updater</a></li> </ol> </li> <li><a href="#running-with-tilt" id="markdown-toc-running-with-tilt">Running with Tilt</a> <ol> <li><a href="#prerequisites" id="markdown-toc-prerequisites">Prerequisites</a></li> <li><a href="#environment-variables" id="markdown-toc-environment-variables">Environment variables</a></li> </ol> </li> <li><a href="#documentation" id="markdown-toc-documentation">Documentation</a></li> </ol> <hr /> <h2 id="building-from-source">Building from source</h2> <h3 id="download-the-source-code">Download the source code</h3> <div class="language-bash highlighter-rouge notranslate"><div class="highlight"><pre class="highlight"><code>git clone https://github.com/kubernetes-sigs/node-feature-discovery
<span class="nb">cd </span>node-feature-discovery
</code></pre> </div></div> <h3 id="docker-build">Docker build</h3> <h4 id="build-the-container-image">Build the container image</h4> <p>See <a href="#customizing-the-build">customizing the build</a> below for altering the container image registry, for example.</p> <div class="language-bash highlighter-rouge notranslate"><div class="highlight"><pre class="highlight"><code>make
</code></pre> </div></div> <h4 id="push-the-container-image">Push the container image</h4> <p>Optional, this example with Docker.</p> <div class="language-bash highlighter-rouge notranslate"><div class="highlight"><pre class="highlight"><code>docker push &lt;IMAGE_TAG&gt;
</code></pre> </div></div> <h3 id="docker-multi-arch-builds-with-buildx">Docker multi-arch builds with buildx</h3> <p>The default set of architectures enabled for mulit-arch builds are <code class="language-plaintext highlighter-rouge notranslate">linux/amd64</code> and <code class="language-plaintext highlighter-rouge notranslate">linux/arm64</code>. If more architectures are needed one can override the <code class="language-plaintext highlighter-rouge notranslate">IMAGE_ALL_PLATFORMS</code> variable with a comma separated list of <code class="language-plaintext highlighter-rouge notranslate">OS/ARCH</code> tuples.</p> <h4 id="build-the-manifest-list-with-a-container-image-per-arch">Build the manifest-list with a container image per arch</h4> <div class="language-bash highlighter-rouge notranslate"><div class="highlight"><pre class="highlight"><code>make image-all
</code></pre> </div></div> <p>Currently <code class="language-plaintext highlighter-rouge notranslate">docker</code> does not support loading of manifest-lists meaning the images are not shown when executing <code class="language-plaintext highlighter-rouge notranslate">docker images</code>, see: <a href="https://github.com/docker/buildx/issues/59">buildx issue #59</a>.</p> <h4 id="push-the-manifest-list-with-container-image-per-arch">Push the manifest-list with container image per arch</h4> <div class="language-bash highlighter-rouge notranslate"><div class="highlight"><pre class="highlight"><code>make push-all
</code></pre> </div></div> <p>The resulting container image can be used in the same way on each arch by pulling e.g. <code class="language-plaintext highlighter-rouge notranslate">node-feature-discovery:master</code> without specifying the architecture. The manifest-list will take care of providing the right architecture image.</p> <h4 id="change-the-job-spec-to-use-your-custom-image-optional">Change the job spec to use your custom image (optional)</h4> <p>To use your published image from the step above instead of the <code class="language-plaintext highlighter-rouge notranslate">registry.k8s.io/nfd/node-feature-discovery</code> image, edit <code class="language-plaintext highlighter-rouge notranslate">image</code> attribute in the spec template(s) to the new location (<code class="language-plaintext highlighter-rouge notranslate">&lt;registry-name&gt;/&lt;image-name&gt;[:&lt;version&gt;]</code>).</p> <h3 id="deployment">Deployment</h3> <p>The <code class="language-plaintext highlighter-rouge notranslate">yamls</code> makefile generates a <code class="language-plaintext highlighter-rouge notranslate">kustomization.yaml</code> matching your locally built image and using the <code class="language-plaintext highlighter-rouge notranslate">deploy/overlays/default</code> deployment. See <a href="#customizing-the-build">build customization</a> below for configurability, e.g. changing the deployment namespace.</p> <div class="language-bash highlighter-rouge notranslate"><div class="highlight"><pre class="highlight"><code><span class="nv">K8S_NAMESPACE</span><span class="o">=</span>my-ns make yamls
kubectl apply <span class="nt">-k</span> <span class="nb">.</span>
</code></pre> </div></div> <p>You can use alternative deployment methods by modifying the auto-generated kustomization file.</p> <h3 id="building-locally">Building locally</h3> <p>You can also build the binaries locally</p> <div class="language-bash highlighter-rouge notranslate"><div class="highlight"><pre class="highlight"><code>make build
</code></pre> </div></div> <p>This will compile binaries under <code class="language-plaintext highlighter-rouge notranslate">bin/</code></p> <h3 id="customizing-the-build">Customizing the build</h3> <p>There are several Makefile variables that control the build process and the name of the resulting container image. The following are targeted targeted for build customization and they can be specified via environment variables or makefile overrides.</p> <table> <thead> <tr> <th>Variable</th> <th>Description</th> <th>Default value</th> </tr> </thead> <tbody> <tr> <td>HOSTMOUNT_PREFIX</td> <td>Prefix of system directories for feature discovery (local builds)</td> <td>/ (<em>local builds</em>) /host- (<em>container builds</em>)</td> </tr> <tr> <td>IMAGE_BUILD_CMD</td> <td>Command to build the image</td> <td>docker build</td> </tr> <tr> <td>IMAGE_BUILD_EXTRA_OPTS</td> <td>Extra options to pass to build command</td> <td><em>empty</em></td> </tr> <tr> <td>IMAGE_BUILDX_CMD</td> <td>Command to build and push multi-arch images with buildx</td> <td>DOCKER_CLI_EXPERIMENTAL=enabled docker buildx build platform=${IMAGE_ALL_PLATFORMS} progress=auto pull</td> </tr> <tr> <td>IMAGE_ALL_PLATFORMS</td> <td>Comma separated list of OS/ARCH tuples for mulit-arch builds</td> <td>linux/amd64,linux/arm64</td> </tr> <tr> <td>IMAGE_PUSH_CMD</td> <td>Command to push the image to remote registry</td> <td>docker push</td> </tr> <tr> <td>IMAGE_REGISTRY</td> <td>Container image registry to use</td> <td>registry.k8s.io/nfd</td> </tr> <tr> <td>IMAGE_TAG_NAME</td> <td>Container image tag name</td> <td>&lt;nfd version&gt;</td> </tr> <tr> <td>IMAGE_EXTRA_TAG_NAMES</td> <td>Additional container image tag(s) to create when building image</td> <td><em>empty</em></td> </tr> <tr> <td>K8S_NAMESPACE</td> <td>nfd-master and nfd-worker namespace</td> <td>node-feature-discovery</td> </tr> </tbody> </table> <p>For example, to use a custom registry:</p> <div class="language-bash highlighter-rouge notranslate"><div class="highlight"><pre class="highlight"><code>make <span class="nv">IMAGE_REGISTRY</span><span class="o">=</span>&lt;my custom registry uri&gt;
</code></pre> </div></div> <p>Or to specify a build tool different from Docker, It can be done in 2 ways:</p> <ol> <li> <p>via environment</p> <div class="language-bash highlighter-rouge notranslate"><div class="highlight"><pre class="highlight"><code> <span class="nv">IMAGE_BUILD_CMD</span><span class="o">=</span><span class="s2">"buildah bud"</span> make
</code></pre> </div> </div> </li> <li> <p>by overriding the variable value</p> <div class="language-bash highlighter-rouge notranslate"><div class="highlight"><pre class="highlight"><code> make <span class="nv">IMAGE_BUILD_CMD</span><span class="o">=</span><span class="s2">"buildah bud"</span>
</code></pre> </div> </div> </li> </ol> <h3 id="testing">Testing</h3> <p>Unit tests are automatically run as part of the container image build. You can also run them manually in the source code tree by running:</p> <div class="language-bash highlighter-rouge notranslate"><div class="highlight"><pre class="highlight"><code>make <span class="nb">test</span>
</code></pre> </div></div> <p>End-to-end tests are built on top of the e2e test framework of Kubernetes, and, they required a cluster to run them on. For running the tests on your test cluster you need to specify the kubeconfig to be used:</p> <div class="language-bash highlighter-rouge notranslate"><div class="highlight"><pre class="highlight"><code>make e2e-test <span class="nv">KUBECONFIG</span><span class="o">=</span><span class="nv">$HOME</span>/.kube/config
</code></pre> </div></div> <p>There are several environment variables that can be used to customize the e2e-tests:</p> <table> <thead> <tr> <th>Variable</th> <th>Description</th> <th>Default value</th> </tr> </thead> <tbody> <tr> <td>KUBECONFIG</td> <td>Kubeconfig for running e2e-tests</td> <td><em>empty</em></td> </tr> <tr> <td>E2E_TEST_CONFIG</td> <td>Parameterization file of e2e-tests (see <a href="https://github.com/kubernetes-sigs/node-feature-discovery/blob/master/test/e2e/e2e-test-config.exapmle.yaml">example</a>)</td> <td><em>empty</em></td> </tr> <tr> <td>E2E_PULL_IF_NOT_PRESENT</td> <td>True-ish value makes the image pull policy IfNotPresent (to be used only in e2e tests)</td> <td>false</td> </tr> <tr> <td>E2E_TEST_FULL_IMAGE</td> <td>Run e2e-test also against the Full Image tag</td> <td>false</td> </tr> <tr> <td>E2E_GINKGO_LABEL_FILTER</td> <td>Ginkgo label filter to use for running e2e tests</td> <td><em>empty</em></td> </tr> <tr> <td>OPENSHIFT</td> <td>Non-empty value enables OpenShift specific support (only affects e2e tests)</td> <td><em>empty</em></td> </tr> </tbody> </table> <h2 id="running-locally">Running locally</h2> <blockquote> <p><strong>**DEPRECATED</strong>: Running NFD locally is deprecated and will be removed in a future release. It depends on the gRPC API which is deprecated and will be removed in a future release. To run NFD locally, disable the NodeFeature API with <code class="language-plaintext highlighter-rouge notranslate">-feature-gates NodeFeatureAPI=false</code> flag.</p> </blockquote> <p>You can run NFD locally, either directly on your host OS or in containers for testing and development purposes. This may be useful e.g. for checking features-detection.</p> <h3 id="nfd-master">NFD-Master</h3> <p>When running as a standalone container labeling is expected to fail because Kubernetes API is not available. Thus, it is recommended to use <code class="language-plaintext highlighter-rouge notranslate">-no-publish</code> Also specify <code class="language-plaintext highlighter-rouge notranslate">-crd-controller=false</code> and <code class="language-plaintext highlighter-rouge notranslate">-feature-gates NodeFeatureAPI=false</code> command line flags to disable CRD controller and enable gRPC. E.g.</p> <div class="language-bash highlighter-rouge notranslate"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span><span class="nb">export </span><span class="nv">NFD_CONTAINER_IMAGE</span><span class="o">=</span>gcr.io/k8s-staging-nfd/node-feature-discovery:master
<span class="nv">$ </span>docker run <span class="nt">--rm</span> <span class="nt">--name</span><span class="o">=</span>nfd-test <span class="k">${</span><span class="nv">NFD_CONTAINER_IMAGE</span><span class="k">}</span> nfd-master <span class="nt">-no-publish</span> <span class="nt">-crd-controller</span><span class="o">=</span><span class="nb">false</span> <span class="nt">-feature-gates</span> <span class="nv">NodeFeatureAPI</span><span class="o">=</span><span class="nb">false
</span>2019/02/01 14:48:21 Node Feature Discovery Master &lt;NFD_VERSION&gt;
2019/02/01 14:48:21 gRPC server serving on port: 8080
</code></pre> </div></div> <h3 id="nfd-worker">NFD-Worker</h3> <p>To run nfd-worker as a "stand-alone" container you need to run it in the same network namespace as the nfd-master container:</p> <div class="language-bash highlighter-rouge notranslate"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>docker run <span class="nt">--rm</span> <span class="nt">--network</span><span class="o">=</span>container:nfd-test <span class="k">${</span><span class="nv">NFD_CONTAINER_IMAGE</span><span class="k">}</span> nfd-worker <span class="nt">-feature-gates</span> <span class="nv">NodeFeatureAPI</span><span class="o">=</span><span class="nb">false
</span>2019/02/01 14:48:56 Node Feature Discovery Worker &lt;NFD_VERSION&gt;
...
</code></pre> </div></div> <p>If you just want to try out feature discovery without connecting to nfd-master, pass the <code class="language-plaintext highlighter-rouge notranslate">-no-publish</code> flag to nfd-worker.</p> <blockquote> <p><strong>NOTE:</strong> Some feature sources need certain directories and/or files from the host mounted inside the NFD container. Thus, you need to provide Docker with the correct <code class="language-plaintext highlighter-rouge notranslate">--volume</code> options for them to work correctly when run stand-alone directly with <code class="language-plaintext highlighter-rouge notranslate">docker run</code>. See the <a href="https://github.com/kubernetes-sigs/node-feature-discovery/blob/master/deployment/components/common/worker-mounts.yaml">default deployment</a> for up-to-date information about the required volume mounts.</p> </blockquote> <h3 id="nfd-topology-updater">NFD-Topology-Updater</h3> <p>To run nfd-topology-updater as a "stand-alone" container you need to run it in with the <code class="language-plaintext highlighter-rouge notranslate">-no-publish</code> flag to disable communication to the Kubernetes apiserver.</p> <div class="language-bash highlighter-rouge notranslate"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>docker run <span class="nt">--rm</span> <span class="k">${</span><span class="nv">NFD_CONTAINER_IMAGE</span><span class="k">}</span> nfd-topology-updater <span class="nt">-no-publish</span>
2019/02/01 14:48:56 Node Feature Discovery Topology Updater &lt;NFD_VERSION&gt;
...
</code></pre> </div></div> <p>If you just want to try out resource topology discovery without connecting to the Kubernetes API, pass the <code class="language-plaintext highlighter-rouge notranslate">-no-publish</code> flag to nfd-topology-updater.</p> <blockquote> <p><strong>NOTE:</strong> NFD topology updater needs certain directories and/or files from the host mounted inside the NFD container. Thus, you need to provide Docker with the correct <code class="language-plaintext highlighter-rouge notranslate">--volume</code> options for them to work correctly when run stand-alone directly with <code class="language-plaintext highlighter-rouge notranslate">docker run</code>. See the <a href="https://github.com/kubernetes-sigs/node-feature-discovery/blob/master/deployment/components/topology-updater/topologyupdater-mounts.yaml">template spec</a> for up-to-date information about the required volume mounts.</p> </blockquote> <h2 id="running-with-tilt">Running with Tilt</h2> <p>Another option for building NFD locally is via Tilt tool, which can build container images, push them to a local registry and reload your Kubernetes pods automatically. When using Tilt, you don't have to build container images and re-deploy your pods manually but instead let the Tilt take care of it. Tiltfile is a configuration file for the Tilt and is located at the root directory. To develop NFD with Tilt, follow the steps below.</p> <h3 id="prerequisites">Prerequisites</h3> <ol> <li>Install <a href="https://docs.docker.com/engine/install/">Docker</a></li> <li>Setup Docker as a non-root user.</li> <li>Install <a href="https://kubernetes.io/docs/tasks/tools/">kubectl</a></li> <li>Install <a href="https://github.com/kubernetes-sigs/kustomize">kustomize</a></li> <li>Install <a href="https://docs.tilt.dev/install.html">tilt</a></li> <li>Create a local Kubernetes cluster</li> </ol> <p>To start up your Tilt development environment, run</p> <div class="language-shell highlighter-rouge notranslate"><div class="highlight"><pre class="highlight"><code>tilt up
</code></pre> </div></div> <p>at the root of your local NFD codebase. Tilt will start a web interface in the localhost and port 10350. From the web interface, you are able to see how NFD worker and master are progressing, watch their build and runtime logs. Once your code changes are saved locally, Tilt will notice it and re-build the container image from the current code, push the image to the registry and re-deploy NFD pods with the latest container image.</p> <h3 id="environment-variables">Environment variables</h3> <p>To override environment variables used in the Tiltfile during image build, export them in your current terminal before starting Tilt.</p> <div class="language-shell highlighter-rouge notranslate"><div class="highlight"><pre class="highlight"><code><span class="nb">export </span><span class="nv">IMAGE_TAG_NAME</span><span class="o">=</span><span class="s2">"v1"</span>
tilt up
</code></pre> </div></div> <p>This will override the default value(<code class="language-plaintext highlighter-rouge notranslate">master</code>) of <code class="language-plaintext highlighter-rouge notranslate">IMAGE_TAG_NAME</code> variable defined in the Tiltfile.</p> <h2 id="documentation">Documentation</h2> <p>All documentation resides under the <a href="https://github.com/kubernetes-sigs/node-feature-discovery/tree/master/docs">docs</a> directory in the source tree. It is designed to be served as a html site by <a href="https://pages.github.com/">GitHub Pages</a>.</p> <p>Building the documentation is containerized to fix the build environment. The recommended way for developing documentation is to run:</p> <div class="language-bash highlighter-rouge notranslate"><div class="highlight"><pre class="highlight"><code>make site-serve
</code></pre> </div></div> <p>This will build the documentation in a container and serve it under <a href="http://localhost:4000/">localhost:4000/</a> making it easy to verify the results. Any changes made to the <code class="language-plaintext highlighter-rouge notranslate">docs/</code> will automatically re-trigger a rebuild and are reflected in the served content and can be inspected with a browser refresh.</p> <p>To just build the html documentation run:</p> <div class="language-bash highlighter-rouge notranslate"><div class="highlight"><pre class="highlight"><code>make site-build
</code></pre> </div></div> <p>This will generate html documentation under <code class="language-plaintext highlighter-rouge notranslate">docs/_site/</code>.</p> <!-- Links --> </div> </div> <hr> <div class="copyright text-center text-gray" role="contentinfo"> <i class="fa fa-copyright"></i> <span class="time">2016-2024,</span> <a class="text-gray" href="https://github.com/kubernetes-sigs" rel="noreferrer" target="_blank">Kubernetes SIGs</a> Revision <a class="text-gray" href="https://github.com/kubernetes-sigs/node-feature-discovery/commit/" title="" rel="noreferrer" target="_blank"></a> <br> <div class="generator"> Built with <a href="https://pages.github.com" rel="noreferrer" target="_blank" title="github-pages v228">GitHub Pages</a> using a <a href="https://github.com/rundocs/jekyll-rtd-theme" rel="noreferrer" target="_blank" title="jekyll-rtd-theme v2.0.10">theme</a> provided by <a href="https://rundocs.io" rel="noreferrer" target="_blank">RunDocs</a>. </div> </div> </div> </div> <div class="addons-wrap d-flex flex-column overflow-y-auto"> <div class="status d-flex flex-justify-between p-2"> <div class="title p-1"> <i class="fa fa-book"></i> Node Feature Discovery </div> <div class="branch p-1"> <span class="name"> master </span> <i class="fa fa-caret-down"></i> </div> </div> <div class="addons d-flex flex-column height-full p-2 d-none"> <dl id="versions"> <dt>Versions</dt> <script src="/node-feature-discovery/versions.js"></script> <script> var dt = document.getElementById('versions'); var items = getVersionListItems(); for (var i=0; i < items.length; i++) { var dd = document.createElement('dd'); var a = 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> <a href="https://github.com/kubernetes-sigs/node-feature-discovery" title="Stars: 782"> <i class="fa fa-github"></i> Homepage </a> </dd> <dd> <a href="https://github.com/kubernetes-sigs/node-feature-discovery/issues" title="Open issues: 49"> <i class="fa fa-question-circle-o"></i> Issues </a> </dd> <dd> <a href="https://github.com/kubernetes-sigs/node-feature-discovery/zipball/gh-pages" title="Size: 106059 Kb"> <i class="fa fa-download"></i> Download </a> </dd> </dl> <hr> <div class="license f6 pb-2"> This <a href="/node-feature-discovery/master/" title="Node Feature Discovery">Software</a> is under the terms of <a href="https://github.com/kubernetes-sigs/node-feature-discovery">Apache License 2.0</a>. </div> </div> </div> <script src="https://cdn.jsdelivr.net/gh/rundocs/jekyll-rtd-theme@2.0.10/assets/js/jquery.min.js"></script><script src="https://cdn.jsdelivr.net/gh/rundocs/jekyll-rtd-theme@2.0.10/assets/js/theme.min.js"></script> </body> </html>