A Kubernetes operator that manages blackbox_exporter probe modules as custom resources. Instead of manually editing a monolithic ConfigMap, you define individual BlackboxModule CRs and the operator aggregates them into the blackbox_exporter configuration.
This operator watches BlackboxModule custom resources and reconciles them into a single ConfigMap consumed by blackbox_exporter. This enables:
- GitOps-friendly probe module management — each module is its own CR
- Team-scoped ownership — RBAC controls who can create/modify which modules
- Automatic aggregation — all modules are merged into the blackbox_exporter
config.yml
apiVersion: module.monitoring.ruup.amadeus.net/v1alpha1
kind: BlackboxModule
metadata:
name: http-2xx
spec:
prober: http
timeout: "5s"
http:
validStatusCodes: [200, 201, 202]
method: GET
followRedirects: true
failIfNotSsl: true
tlsConfig:
insecureSkipVerify: false- You create
BlackboxModulecustom resources (one per probe module) in any namespace. - The operator watches all
BlackboxModuleCRs and aggregates them into a single ConfigMap (default:blackbox-exporter-configin themonitoringnamespace). - The ConfigMap is created automatically if it doesn't exist.
- Each module is keyed as
<namespace>/<name>in theconfig.ymldata. - After updating the ConfigMap, the operator triggers a reload on blackbox_exporter via its
/-/reloadHTTP endpoint (if--blackbox-reload-urlis configured).
Note: the
/-/reloadendpoint is only served when blackbox_exporter is started with--web.enable-lifecycle(it can otherwise reload onSIGHUP). The ConfigMap is consumed as a mounted volume, so there is a propagation delay between the operator updating the ConfigMap and the new file being visible to the blackbox_exporter pod;--reload-delayaccounts for this before the reload is triggered.
Because every module spec is serialized into the shared ConfigMap, credentials must not be set inline — they would be persisted in plaintext and readable by anyone with get access to the ConfigMap. The validating webhook rejects inline http.basicAuth.password, http.authorization.credentials, and http.oauth2.clientSecret. Use the file- or secret-ref-based variants instead (passwordFile, credentialsFile, clientSecretFile/clientSecretRef), mounting the secret into the blackbox_exporter pod.
- go version v1.22.0+
- docker version 17.03+.
- kubectl version v1.11.3+.
- Access to a Kubernetes v1.11.3+ cluster.
The operator accepts the following flags:
| Flag | Default | Description |
|---|---|---|
--configmap-namespace |
monitoring |
Namespace of the blackbox_exporter ConfigMap |
--configmap-name |
blackbox-exporter-config |
Name of the ConfigMap to manage |
--blackbox-reload-url |
(empty) | URL to trigger blackbox_exporter reload (e.g. http://blackbox-exporter.monitoring.svc:9115/-/reload) |
--reload-delay |
10s |
Delay before triggering reload, to allow ConfigMap volume propagation |
--reload-timeout |
30s |
Timeout for a single blackbox_exporter reload request |
--metrics-bind-address |
0 |
Address for the metrics endpoint |
--health-probe-bind-address |
:8081 |
Address for health probes |
--leader-elect |
false |
Enable leader election for HA |
Build and push your image to the location specified by IMG:
make docker-build docker-push IMG=<some-registry>/blackbox-module-operator:tagNOTE: This image ought to be published in the personal registry you specified. And it is required to have access to pull the image from the working environment. Make sure you have the proper permission to the registry if the above commands don’t work.
Install the CRDs into the cluster:
make installDeploy the Manager to the cluster with the image specified by IMG:
make deploy IMG=<some-registry>/blackbox-module-operator:tagNOTE: If you encounter RBAC errors, you may need to grant yourself cluster-admin privileges or be logged in as admin.
Create instances of your solution You can apply the samples (examples) from the config/sample:
kubectl apply -k config/samples/NOTE: Ensure that the samples has default values to test it out.
Delete the instances (CRs) from the cluster:
kubectl delete -k config/samples/Delete the APIs(CRDs) from the cluster:
make uninstallUnDeploy the controller from the cluster:
make undeployFollowing are the steps to build the installer and distribute this project to users.
- Build the installer for the image built and published in the registry:
make build-installer IMG=<some-registry>/blackbox-module-operator:tagNOTE: The makefile target mentioned above generates an 'install.yaml' file in the dist directory. This file contains all the resources built with Kustomize, which are necessary to install this project without its dependencies.
- Using the installer
Users can just run kubectl apply -f to install the project, i.e.:
kubectl apply -f https://raw.githubusercontent.com/<org>/blackbox-module-operator/<tag or branch>/dist/install.yamlContributions are welcome. Please open an issue or submit a pull request.
NOTE: Run make help for more information on all potential make targets
More information can be found via the Kubebuilder Documentation
Copyright 2025.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.