2022-11-02 12:34:37 +00:00
|
|
|
---
|
|
|
|
title: "Kustomize"
|
|
|
|
layout: default
|
|
|
|
sort: 2
|
|
|
|
---
|
|
|
|
|
2023-05-18 09:29:54 +00:00
|
|
|
# Deployment with Kustomize
|
2022-11-02 12:34:37 +00:00
|
|
|
{: .no_toc}
|
|
|
|
|
|
|
|
## Table of contents
|
|
|
|
{: .no_toc .text-delta}
|
|
|
|
|
|
|
|
1. TOC
|
|
|
|
{:toc}
|
|
|
|
|
|
|
|
---
|
|
|
|
|
2023-11-28 18:27:33 +00:00
|
|
|
[Kustomize](https://github.com/kubernetes-sigs/kustomize) can be used to
|
|
|
|
deploy NFD. Customization of the deployment is done by maintaining
|
2022-12-20 13:14:41 +00:00
|
|
|
declarative overlays on top of the base overlays in NFD.
|
|
|
|
|
|
|
|
To follow the deployment instructions here,
|
2024-07-08 11:09:36 +00:00
|
|
|
[kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl) v1.24 or
|
2022-12-20 13:14:41 +00:00
|
|
|
later is required.
|
|
|
|
|
|
|
|
The kustomize overlays provided in the repo can be used directly:
|
2022-11-02 12:34:37 +00:00
|
|
|
|
|
|
|
```bash
|
2024-10-02 14:07:32 +00:00
|
|
|
kubectl apply -k "https://github.com/kubernetes-sigs/node-feature-discovery/deployment/overlays/default?ref={{ site.release }}"
|
2022-11-02 12:34:37 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
This will required RBAC rules and deploy nfd-master (as a deployment) and
|
|
|
|
nfd-worker (as daemonset) in the `node-feature-discovery` namespace.
|
|
|
|
|
2023-08-03 10:38:07 +00:00
|
|
|
> **NOTE:** nfd-topology-updater is not deployed as part of the `default`
|
2023-12-01 13:55:45 +00:00
|
|
|
> overlay. Refer to the [Master Worker Topologyupdater](#master-worker-topologyupdater)
|
2023-08-03 10:38:07 +00:00
|
|
|
> and [Topologyupdater](#topologyupdater) below.
|
2022-11-02 12:34:37 +00:00
|
|
|
|
|
|
|
Alternatively you can clone the repository and customize the deployment by
|
2023-12-01 14:30:55 +00:00
|
|
|
creating your own overlays. See [kustomize][kustomize] for more information
|
|
|
|
about managing deployment configurations.
|
2022-11-02 12:34:37 +00:00
|
|
|
|
|
|
|
## Overlays
|
|
|
|
|
|
|
|
The NFD repository hosts a set of overlays for different usages and deployment
|
|
|
|
scenarios under
|
|
|
|
[`deployment/overlays`](https://github.com/kubernetes-sigs/node-feature-discovery/blob/{{site.release}}/deployment/overlays)
|
|
|
|
|
|
|
|
- [`default`](https://github.com/kubernetes-sigs/node-feature-discovery/blob/{{site.release}}/deployment/overlays/default):
|
|
|
|
default deployment of nfd-worker as a daemonset, described above
|
|
|
|
- [`default-job`](https://github.com/kubernetes-sigs/node-feature-discovery/blob/{{site.release}}/deployment/overlays/default-job):
|
|
|
|
see [Worker one-shot](#worker-one-shot) below
|
|
|
|
- [`master-worker-topologyupdater`](https://github.com/kubernetes-sigs/node-feature-discovery/blob/{{site.release}}/deployment/overlays/master-worker-topologyupdater):
|
|
|
|
see [Master Worker Topologyupdater](#master-worker-topologyupdater) below
|
|
|
|
- [`topologyupdater`](https://github.com/kubernetes-sigs/node-feature-discovery/blob/{{site.release}}/deployment/overlays/topologyupdater):
|
|
|
|
see [Topology Updater](#topologyupdater) below
|
2023-12-21 15:58:01 +00:00
|
|
|
- [`prometheus`](https://github.com/kubernetes-sigs/node-feature-discovery/blob/{{site.release}}/deployment/overlays/prometheus):
|
2023-06-06 14:39:02 +00:00
|
|
|
see [Metrics](#metrics) below
|
2022-11-02 12:34:37 +00:00
|
|
|
- [`prune`](https://github.com/kubernetes-sigs/node-feature-discovery/blob/{{site.release}}/deployment/overlays/prune):
|
|
|
|
clean up the cluster after uninstallation, see
|
2023-01-12 01:23:36 +00:00
|
|
|
[Removing feature labels](uninstallation.md#removing-feature-labels)
|
2022-11-02 12:34:37 +00:00
|
|
|
- [`samples/custom-rules`](https://github.com/kubernetes-sigs/node-feature-discovery/blob/{{site.release}}/deployment/overlays/samples/custom-rules):
|
|
|
|
an example for spicing up the default deployment with a separately managed
|
|
|
|
configmap of custom labeling rules, see
|
2023-01-12 01:23:36 +00:00
|
|
|
[Custom feature source](../usage/features.md#custom) for more information about
|
2022-11-02 12:34:37 +00:00
|
|
|
custom node labels
|
|
|
|
|
|
|
|
### Worker one-shot
|
|
|
|
|
|
|
|
Feature discovery can alternatively be configured as a one-shot job.
|
|
|
|
The `default-job` overlay may be used to achieve this:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
NUM_NODES=$(kubectl get no -o jsonpath='{.items[*].metadata.name}' | wc -w)
|
2024-10-02 14:07:32 +00:00
|
|
|
kubectl kustomize "https://github.com/kubernetes-sigs/node-feature-discovery/deployment/overlays/default-job?ref={{ site.release }}" | \
|
2022-11-02 12:34:37 +00:00
|
|
|
sed s"/NUM_NODES/$NUM_NODES/" | \
|
|
|
|
kubectl apply -f -
|
|
|
|
```
|
|
|
|
|
|
|
|
The example above launches 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.
|
|
|
|
|
|
|
|
### Master Worker Topologyupdater
|
|
|
|
|
2022-12-02 09:47:56 +00:00
|
|
|
NFD-Master, nfd-worker and nfd-topology-updater can be configured to be
|
|
|
|
deployed as separate pods. The `master-worker-topologyupdater` overlay may be
|
|
|
|
used to achieve this:
|
2022-11-02 12:34:37 +00:00
|
|
|
|
|
|
|
```bash
|
2024-10-02 14:07:32 +00:00
|
|
|
kubectl apply -k "https://github.com/kubernetes-sigs/node-feature-discovery/deployment/overlays/master-worker-topologyupdater?ref={{ site.release }}"
|
2022-11-02 12:34:37 +00:00
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
### Topologyupdater
|
|
|
|
|
2023-12-01 13:55:45 +00:00
|
|
|
To deploy just nfd-topology-updater (without nfd-master and nfd-worker)
|
2022-11-02 12:34:37 +00:00
|
|
|
use the `topologyupdater` overlay:
|
|
|
|
|
|
|
|
```bash
|
2024-10-02 14:07:32 +00:00
|
|
|
kubectl apply -k "https://github.com/kubernetes-sigs/node-feature-discovery/deployment/overlays/topologyupdater?ref={{ site.release }}"
|
2022-11-02 12:34:37 +00:00
|
|
|
|
|
|
|
```
|
|
|
|
|
2022-12-02 09:47:56 +00:00
|
|
|
NFD-Topology-Updater can be configured along with the `default` overlay
|
|
|
|
(which deploys nfd-worker and nfd-master) where all the software components
|
|
|
|
are deployed as separate pods;
|
2022-11-02 12:34:37 +00:00
|
|
|
|
|
|
|
```bash
|
|
|
|
|
2024-10-02 14:07:32 +00:00
|
|
|
kubectl apply -k "https://github.com/kubernetes-sigs/node-feature-discovery/deployment/overlays/default?ref={{ site.release }}"
|
|
|
|
kubectl apply -k "https://github.com/kubernetes-sigs/node-feature-discovery/deployment/overlays/topologyupdater?ref={{ site.release }}"
|
2022-11-02 12:34:37 +00:00
|
|
|
|
|
|
|
```
|
|
|
|
|
2023-06-06 14:39:02 +00:00
|
|
|
### Metrics
|
|
|
|
|
|
|
|
To allow [prometheus operator][prometheus-operator]
|
|
|
|
to scrape metrics from node-feature-discovery,
|
|
|
|
run the following command:
|
|
|
|
|
|
|
|
```bash
|
2024-10-02 14:07:32 +00:00
|
|
|
kubectl apply -k "https://github.com/kubernetes-sigs/node-feature-discovery/deployment/overlays/default?ref={{ site.release }}"
|
|
|
|
kubectl apply -k "https://github.com/kubernetes-sigs/node-feature-discovery/deployment/overlays/prometheus?ref={{ site.release }}"
|
2023-06-06 14:39:02 +00:00
|
|
|
```
|
|
|
|
|
2022-11-02 12:34:37 +00:00
|
|
|
## Uninstallation
|
|
|
|
|
|
|
|
Simplest way is to invoke `kubectl delete` on the overlay that was used for
|
|
|
|
deployment. Beware that this will also delete the namespace that NFD is
|
|
|
|
running in. For example, in case the default overlay from the repo was used:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
kubectl delete -k https://github.com/kubernetes-sigs/node-feature-discovery/deployment/overlays/default?ref={{ site.release }}
|
|
|
|
```
|
|
|
|
|
|
|
|
Alternatively you can delete create objects one-by-one, depending on the type
|
|
|
|
of deployment, for example:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
NFD_NS=node-feature-discovery
|
|
|
|
kubectl -n $NFD_NS delete ds nfd-worker
|
|
|
|
kubectl -n $NFD_NS delete deploy nfd-master
|
|
|
|
kubectl -n $NFD_NS delete svc nfd-master
|
|
|
|
kubectl -n $NFD_NS delete sa nfd-master
|
|
|
|
kubectl delete clusterrole nfd-master
|
|
|
|
kubectl delete clusterrolebinding nfd-master
|
|
|
|
```
|
|
|
|
|
|
|
|
<!-- Links -->
|
|
|
|
[kustomize]: https://github.com/kubernetes-sigs/kustomize
|
2023-06-06 14:39:02 +00:00
|
|
|
[prometheus-operator]: https://github.com/prometheus-operator/prometheus-operator
|