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.
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
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.
- Pod, Node, Namespace, Event, Endpoints
- ServiceAccount, LimitRange, ResourceQuota
- Deployments, StatefulSets, DaemonSets
- ReplicaSets, ReplicationControllers
- Jobs, CronJobs
- PersistentVolumeClaims
- PersistentVolumes
- StorageClasses
- Services
- Ingress, IngressClasses
- NetworkPolicies
- Roles, RoleBindings
- ClusterRoles, ClusterRoleBindings
- HorizontalPodAutoscalers
- VerticalPodAutoscalers
- PodDisruptionBudgets
- Custom Resource Definitions (CRDs)
- Custom Resource Instances
- ConfigMaps
- Secrets
- 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)
- 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
- 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
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
)
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"
-
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.
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"
- 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
- Remove CR instances:
kubectl delete -k config/samples/
- Remove CRDs:
make uninstall
- Remove the operator:
make undeploy
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
We welcome contributions! Please see our contributing guidelines for more information.
- Fork the repository
- Create a feature branch
- Make your changes
- Run tests:
make test
- Submit a pull request
Run the test suite:
make test
Run specific tests:
go test ./... -run TestName
- GitHub Issues: Report bugs or request features
- Documentation: Detailed documentation
- Community: Join our community
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.