ZXporter - Kubernetes Resource Exporter
ZXporter is a Kubernetes operator that collects and exports various Kubernetes resources for monitoring and observability purposes. It provides a comprehensive solution for gathering metrics and data from different types of Kubernetes resources across your cluster.
Overview
ZXporter is designed to help you monitor and observe your Kubernetes cluster by collecting data from various resources and making it available for analysis. It's particularly useful for:
- Monitoring cluster health and performance
- Collecting resource utilization metrics
- Tracking configuration changes
- Gathering security-related information
- Supporting compliance and auditing requirements
Architecture
ZXporter operates as a Kubernetes operator with the following components:
- Controller: Manages the lifecycle of collection policies and coordinates data collection
- Collectors: Specialized components for different resource types
- Storage: Temporary buffer for collected data
- Exporters: Components that make the collected data available to external systems
The operator uses a modular design that allows for easy extension and customization.
Features
Core Resources
- Pod, Node, Namespace, Event, Endpoints
- ServiceAccount, LimitRange, ResourceQuota
Workload Resources
- Deployments, StatefulSets, DaemonSets
- ReplicaSets, ReplicationControllers
- Jobs, CronJobs
Storage Resources
- PersistentVolumeClaims
- PersistentVolumes
- StorageClasses
Networking Resources
- Services
- Ingress, IngressClasses
- NetworkPolicies
RBAC Resources
- Roles, RoleBindings
- ClusterRoles, ClusterRoleBindings
Autoscaling Resources
- HorizontalPodAutoscalers
- VerticalPodAutoscalers
Policy Resources
Custom Resources
- Custom Resource Definitions (CRDs)
- Custom Resource Instances
Configuration Resources
Prerequisites
- Go version v1.22.0+
- Docker version 17.03+
- kubectl version v1.11.3+
- Access to a Kubernetes v1.11.3+ cluster
- kind (for local development)
Quick Start
Local Development Setup
- Create a kind cluster:
kind create cluster
- Update kubeconfig:
kubectl cluster-info --context kind-kind
- Install required services:
# Install metrics-server
helm repo add metrics-server https://kubernetes-sigs.github.io/metrics-server/
helm repo update
helm upgrade --install --set args={--kubelet-insecure-tls} metrics-server metrics-server/metrics-server --namespace kube-system
# Install node exporter
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo update
helm install node-exporter prometheus-community/prometheus-node-exporter
- Build and deploy:
make docker-build IMG=zxporter:tag
kind load docker-image zxporter:tag
make deploy IMG=zxporter:tag
Production Deployment
- Build and push the image:
make docker-build docker-push IMG=<your-registry>/zxporter:tag
- Deploy the operator:
make deploy IMG=<your-registry>/zxporter:tag
Helm Deployment
ZXporter can also be deployed using Helm, which provides a more flexible and customizable deployment method.
Quick Install
helm install zxporter ./helm-chart/zxporter --namespace devzero-zxporter --create-namespace
# With Makefile
make helm-chart-install
Custom Configuration
Create a custom values file or override specific values:
# Using custom values file
helm install zxporter ./helm-chart/zxporter -f my-values.yaml
# Override specific values inline
helm install zxporter ./helm-chart/zxporter \
--set zxporter.dakrUrl="https://my-dakr.example.com" \
--set zxporter.targetNamespaces="app1,app2" \
--set image.tag="latest"
Deploy ZXporter with Your Existing Prometheus/Node Exporter
If you already have Prometheus and Node Exporter running in your cluster:
# Install only zxporter (no monitoring components)
helm install zxporter ./helm-chart/zxporter \
--set monitoring.enabled=false \
--set zxporter.prometheusUrl="http://your-prometheus.monitoring.svc.cluster.local:9090" \
--namespace devzero-zxporter \
--create-namespace
# Or use the Makefile target
make helm-chart-install-minimal PROMETHEUS_URL="http://your-prometheus.monitoring.svc.cluster.local:9090"
Note: Checkout helm-chart/zxporter/templates/prometheus-configmap.yaml to get the required configs for custom Prometheus.
Key Configuration Options
zxporter.dakrUrl: DAKR server URL (default: "https://dakr.devzero.io")
zxporter.prometheusUrl: Prometheus server URL
zxporter.targetNamespaces: Comma-separated list of namespaces to monitor (empty = all)
image.repository: Container image repository
image.tag: Container image tag (default: "latest")
monitoring.enabled: Enable/disable all monitoring components (default: true)
monitoring.prometheus.enabled: Enable/disable Prometheus (default: true)
monitoring.nodeExporter.enabled: Enable/disable Node Exporter (default: true)
Upgrade and Uninstall
# Upgrade deployment
helm upgrade zxporter ./helm-chart/zxporter
# Uninstall
helm uninstall zxporter
Configuration
The operator is configured through the CollectionPolicy Custom Resource. Key configuration options include:
targetSelector: Define which namespaces to collect from (empty = collect from all namespaces)
exclusions: Specify namespaces to exclude (default: [])
policies: Configure collection frequency (default: 10s) and buffer size (default: 1000)
Advanced Configuration
apiVersion: devzero.io/v1
kind: CollectionPolicy
metadata:
name: advanced-policy
namespace: devzero-zxporter
spec:
targetSelector:
namespaces: ["app1", "app2"]
labelSelector:
matchLabels:
environment: production
exclusions:
excludedNamespaces:
- kube-system
- kube-public
excludedResources:
- secrets
- configmaps
policies:
frequency: "30s"
bufferSize: 1000
retentionPeriod: "24h"
exportFormat: "prometheus"
Troubleshooting
Common Issues
-
RBAC Permission Errors
Error: failed to create resource: the server does not allow access to the requested resource
Solution: Ensure the operator has the necessary RBAC permissions:
kubectl create clusterrolebinding zxporter-admin --clusterrole=cluster-admin --serviceaccount=devzero-zxporter:zxporter-controller-manager
-
Collection Policy Not Applied
Error: no collection policy found in namespace
Solution: Verify the CollectionPolicy CR is properly created:
kubectl get collectionpolicy -n devzero-zxporter
-
High Resource Usage
If the operator is consuming too many resources, adjust the collection frequency and buffer size in the policy.
Logs and Debugging
View operator logs:
kubectl logs -n devzero-zxporter deployment/zxporter-controller-manager
Enable debug logging:
apiVersion: devzero.io/v1
kind: CollectionPolicy
metadata:
name: debug-policy
spec:
policies:
logLevel: "debug"
Security Considerations
- The operator requires cluster-wide permissions to collect data
- Sensitive data (like Secrets) are excluded from collection
- Network communication is secured using TLS
- RBAC policies should be carefully configured
For optimal performance:
- Adjust collection frequency based on your needs
- Configure appropriate buffer sizes
- Use namespace selectors to limit collection scope
- Monitor resource usage and adjust accordingly
Uninstallation
- Remove CR instances:
kubectl delete -k config/samples/
- Remove CRDs:
make uninstall
- Remove the operator:
make undeploy
Project Distribution
To build the installer:
make build-installer IMG=<your-registry>/zxporter:tag
This generates an install.yaml in the dist directory containing all necessary resources.
Users can install using:
kubectl apply -f https://raw.githubusercontent.com/<org>/zxporter/<tag>/dist/install.yaml
Contributing
We welcome contributions! Please see our contributing guidelines for more information.
Development Setup
- Fork the repository
- Create a feature branch
- Make your changes
- Run tests:
make test
- Submit a pull request
Testing
Run the test suite:
make test
Run specific tests:
go test ./... -run TestName
Support
License
Copyright 2026 DevZero - LICENSE.
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.