1
0
Fork 0
mirror of https://github.com/kubernetes-sigs/node-feature-discovery.git synced 2024-12-15 17:50:49 +00:00
node-feature-discovery/docs/usage/kubectl-plugin.md
Markus Lehtonen de2a212002 docs: fixes
- Fix broken link to nodefeaturerule samples
- Fix sample output of kubectl plugin
2023-12-21 18:34:07 +02:00

1.7 KiB

title layout sort
Kubectl plugin default 10

Kubectl plugin

{: .no_toc}

Table of contents

{: .no_toc .text-delta}

  1. TOC {:toc}

Developer Preview This feature is currently in developer preview and subject to change. It is not recommended to use it in production environments.

Overview

The kubectl plugin kubectl nfd can be used to validate/dryrun and test NodeFeatureRule objects. It can be installed with the following command:

git clone https://github.com/kubernetes-sigs/node-feature-discovery
cd node-feature-discovery
make build-kubectl-nfd
KUBECTL_PATH=/usr/local/bin/
mv ./bin/kubectl-nfd ${KUBECTL_PATH}

Validate

The plugin can be used to validate a NodeFeatureRule object:

kubectl nfd validate -f <nodefeaturerule.yaml>

Test

The plugin can be used to test a NodeFeatureRule object against a node:

kubectl nfd test -f <nodefeaturerule.yaml> -n <node-name>

DryRun

The plugin can be used to DryRun a NodeFeatureRule object against a NodeFeature file:

kubectl get -n node-feature-discovery nodefeature <nodename> -o yaml > <nodefeature.yaml>
kubectl nfd dryrun -f <nodefeaturerule.yaml> -n <nodefeature.yaml>

Or you can use the example NodeFeature file(it is a minimal NodeFeature file):

$ kubectl nfd dryrun -f examples/nodefeaturerule.yaml -n examples/nodefeature.yaml
Evaluating NodeFeatureRule "examples/nodefeaturerule.yaml" against NodeFeature "examples/nodefeature.yaml"
Processing rule:  my sample rule
*** Labels ***
vendor.io/my-sample-feature=true
NodeFeatureRule "examples/nodefeaturerule.yaml" is valid for NodeFeature "examples/nodefeature.yaml"