knbud scales Kubernetes workloads down safely before NFS maintenance and scales them back up afterwards.
It supports Deployments, StatefulSets, and CronJobs.
Download an archive from the latest release.
Choose linux, macos, or windows, then choose your CPU architecture:
x86_64for Intel or AMDarm64for ARM or Apple Silicon
On Linux or macOS:
tar -xzf knbud_<version>_<os>_<architecture>.tar.gz
chmod +x knbud
./knbud --helpOn Windows, extract the .zip file and run:
.\knbud.exe --helpmake vet
make test
make buildThe binary is written to ./knbud.
The first stage. discover reads the live cluster.
Inspect the cluster without writing a file:
./knbud discover --dry-runCreate or update knbud.yaml:
./knbud discoverHigh-confidence dependencies are saved automatically. Unclear dependencies are shown for review. Flux support and hidden dependencies are handled by short prompts.
Use flags for a non-interactive run:
./knbud discover --accept-suggestions
./knbud discover --ignore-suggestionsAny dependency not auto-discovered must be added to customDependencies, see Configuration.
Plan commands use only the saved relationships in knbud.yaml.
Print a scale down plan:
./knbud plan down --dry-runPrint and apply it:
./knbud plan downOnce the NFS service is online again, scale back up:
./knbud plan upSkip the confirmation prompt:
./knbud plan down --yes
./knbud plan up --yesUseful flags:
| Option | Default | Use |
|---|---|---|
--config |
knbud.yaml |
Config file |
--kubeconfig |
client-go default | Kubeconfig file |
--context |
current context | Kubernetes context |
--output |
human |
human or json |
--parallelism |
8 |
Actions per wave |
--timeout |
5m |
Timeout per workload |
version: 1
storageClasses:
- shared-nfs
inference:
serviceReferences: true
gitOps:
flux:
enabled: true
mode: auto
customGroups:
web:
selectors:
- kind: Deployment
namespace: example
matchLabels:
app.kubernetes.io/part-of: web
database:
resources:
- kind: StatefulSet
namespace: example
name: database
customDependencies:
- consumer: web
provider: database
include:
- kind: Deployment
namespace: example
name: storage-operator
exclude:
- kind: Deployment
namespace: example
name: unmanagedgroups and dependencies are managed by discover.
Use customGroups and customDependencies for hand-written rules. discover preserves them.
A dependency points from consumer to provider. Consumers scale down first. Providers scale up first.
include adds a workload to the scale down plan. exclude keeps it out. Saved state still allows an excluded workload to be scaled up.
Selectors support name, matchLabels, or labelSelector. A missing namespace matches every namespace.
NFS use is found from:
- PVC storage classes
- NFS persistent volumes
- inline NFS volumes
- the NFS CSI driver
- StatefulSet claim templates
Service dependencies are found in container commands, arguments, environment values, and ConfigMaps. The Service must be in the same namespace. A single matching workload is accepted automatically.
Ambiguous Services and Ingress hostnames require review. Suggestions that cannot change the plan are hidden.
Secrets are never read. Add dependencies stored in Secrets or application settings by hand.
Pushgateway and Alertmanager endpoints are treated as telemetry, not runtime dependencies.
Accepted and inferred dependencies are saved in knbud.yaml. Planning does not infer them again.
Flux auto mode suspends owners of workloads in the plan:
gitOps:
flux:
enabled: true
mode: autoFlux and Argo CD can use an explicit list:
gitOps:
flux:
enabled: true
mode: explicit
resources:
- kind: Kustomization
namespace: gitops-system
name: example
argoCD:
enabled: true
mode: explicit
resources:
- kind: Application
namespace: argocd
name: exampleArgo CD supports explicit mode only.
Scaling down (plan down) runs consumers before providers. Scaling up (plan up) uses the reverse order. Workloads in one wave run in parallel.
Original replica and suspension values are stored in annotations. They are removed only after a successful scale up. Interrupted operations can be run again.
HorizontalPodAutoscalers block planning. Active CronJob Jobs must finish before scale down completes.
Operator-managed workloads produce warnings. Include the operator and add a dependency in customDependencies when it must scale down first.