This guide provides the steps and commands necessary to set up a simulated edge device metrics export tool that integrates with a Kubernetes-native monitoring system (Prometheus ecosystem).
Tech Stack: Basics of YAML, Command-line, Simple Python/Go (Simulated)
The standard approach uses the Prometheus ecosystem, with the tool acting as a custom metrics exporter.
- Edge Device Simulator (Python/Go): A script that generates simulated metrics (e.g.,
cpu_usage,memory_allocated). - Kubernetes Manifests (YAML): Configuration files to deploy the simulator and necessary services in Kubernetes.
- Command-line Interface (CLI):
kubectland possiblycurlfor deployment and verification.
Note: Prometheus is a system that collects, stores, and queries time-series metrics.
- ✅ Only 1 Python file (The metrics server:
exporter.py) - ✅ Only 1 Kubernetes YAML file (The deployment:
edge-exporter.yaml) - ✅ No Prometheus client library (Simple text output)
- ✅ No DaemonSet, only a single Pod (Simplest deployment)
- ✅ Works with
curl,kubectl, and Docker
Minikube starts a single-node Kubernetes cluster for local development.
brew install minikubeminikube start
kubectl get nodesYou should see the node status:
NAME STATUS ROLES AGE VERSION
minikube Ready control-plane 53s v1.34.0
Make Minikube use your local Docker daemon so the image you build is accessible inside the cluster.
eval $(minikube docker-env)Build the container image using the Dockerfile in the current directory.
docker build -t edge-metrics .You must have the edge-exporter.yaml file ready. This manifest defines:
- A Deployment (to run the Pod)
- A Service (to expose the metrics port 8080 internally, annotated for Prometheus scraping)
Run the following command to deploy the resources defined in the YAML file:
kubectl apply -f edge-exporter.yamlCheck the status of the Pod deployed by your Deployment.
kubectl get podsSimple Definition: A Pod is the smallest deployable unit in Kubernetes. It's a box that usually contains one container (your Python metrics exporter).
You should see output similar to this:
NAME READY STATUS RESTARTS AGE
edge-exporter-deployment-xxxxx 1/1 Running 0 5s
Find the exact Pod name and forward its port 8080 to your local machine to ensure the metrics server is live and responding. Prometheus-style metrics must change every time you refresh.
Find the Pod name:
kubectl get podsForward the port: (Open a dedicated terminal window)
kubectl port-forward <pod-name> 8080:8080Test the output: (Open a new terminal window)
curl http://localhost:8080/metricsRun this command to automatically open the Prometheus UI in your browser:
minikube service prometheus-serverNote: Keep this terminal window open — it handles the connection/proxy.
In the Prometheus UI, go to: Status → Targets.
Look for your edge-exporter-service pod in the table.
It should show State = UP.
If it shows DOWN, check the pod logs:
kubectl logs <pod-name>Go to the Graph tab in the Prometheus UI.
In the expression box, type the name of one of your custom metrics:
cpu_usage
Click Execute.
Switch to Graph view: you should see metrics updating.
Repeat with your other metric:
memory_allocated
project/
├── exporter.py # Python metrics exporter script
├── edge-exporter.yaml # Kubernetes deployment manifest
├── Dockerfile # Container image definition
└── README.md # This file
Issue: Pod shows ImagePullBackOff error
- Solution: Ensure you ran
eval $(minikube docker-env)before building the Docker image
Issue: Metrics endpoint returns connection refused
- Solution: Verify the pod is running with
kubectl get podsand check logs withkubectl logs <pod-name>
Issue: Prometheus shows target as DOWN
- Solution: Check that the Service is properly configured and the pod is exposing metrics on port 8080
Issue: minikube service prometheus-server fails
- Solution: Ensure Prometheus is installed in your cluster. You may need to install it using Helm or kubectl apply
To remove all deployed resources:
kubectl delete -f edge-exporter.yamlTo stop Minikube:
minikube stopTo delete the Minikube cluster:
minikube delete- Add more realistic metrics (temperature, network throughput, disk I/O)
- Implement custom labels for multi-device scenarios
- Create alerting rules in Prometheus
- Add Grafana dashboards for visualization
- Scale to multiple edge device simulators
- Doc Link : https://docs.google.com/document/d/1X-oaQYzDJqMBkOdPitBkrnm5JZRhxBEBKUNdarT7dxU/edit?tab=t.0
- Prometheus Documentation
- Kubernetes Documentation
- Minikube Documentation
- Writing Exporters for Prometheus


