Skip to content

prdktntwcklr/cloudmetrics

Repository files navigation

Cloudmetrics

A Go-based sensor simulator for Kubernetes, featuring a complete observability stack. It generates real-time temperature telemetry and reading counts, exported via Prometheus metrics and Loki-compatible logs, fully automated and deployed via GitOps using Argo CD.

Prerequisites

  • A running Kubernetes cluster
  • Helm (package manager for Kubernetes) installed

Deployment

Install Argo CD

First, install Argo CD into your cluster:

kubectl create namespace argocd
kubectl apply -n argocd --server-side --force-conflicts -f https://raw.githubusercontent.com/argoproj/argo-cd/v3.4.3/manifests/install.yaml

Create the Grafana Password

Before deploying, create the password required to log into the Grafana UI. Ensure that this namespace matches the target namespace of your Grafana deployment (defaulting to monitoring).

kubectl create namespace monitoring
kubectl create secret generic grafana-admin-secret \
  -n monitoring \
  --from-literal=admin-user=admin \
  --from-literal=admin-password='supersecurepassword'

Deploy the Stack (App-of-Apps)

This uses the Argo CD App of Apps pattern. Deploying the single root bootstrap application will automatically discover, configure, and roll out the entire application and observability pipeline:

kubectl apply -f argocd-apps/root-app.yaml

Accessing Data

  1. Application Metrics: Visit http://localhost:8080/ and click on Metrics to see the raw Prometheus format.

    Homepage

  2. Grafana UI: To access the Grafana UI, first port-forward it:

    kubectl port-forward svc/prometheus-grafana -n monitoring 3000:80

    Metrics: Open http://localhost:3000/ and log in using the username and password you stored in the Kubernetes secret above. You should be able to open the Cloudmetrics dashboard to see the metrics being displayed.

    Grafana Dashboard

    Logs: Go to Drilldown > Logs to see logs for different services running in your cluster.

    Grafana Logs

  3. Argo CD Dashboard: Use port forwarding:

    # Use local port 7070 to avoid conflicts with the application port (8080)
    kubectl port-forward svc/argocd-server -n argocd 7070:443

    After that, open your browser and head to: https://localhost:7070/. Ignore the Certificate Error warning (Argo CD uses a self-signed certificate) and click on Proceed anyway.

    The default username is admin. Argo CD automatically generates a unique startup password and stores it securely in a Kubernetes secret. Retrieve and decode it by running:

    kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d; echo

    You should be able to explore the state of the running applications:

    Argo CD UI

Development & Testing

If you add new Go packages, update the go.mod and go.sum files using a container:

docker run --rm -v ./app:/app -w /app golang:1.23-alpine sh -c "go mod init cloudmetrics-app ; go mod tidy"

Cleanup

Because of the App of Apps pattern, you can tear down the entire application, the observability stack, and all associated resources with a single command:

kubectl delete -f argocd-apps/root-app.yaml

Note that Custom Resource Definitions (CRDs) are not deleted automatically. For details on how to uninstall them, refer to the kube-prometheus-stack official documentation.

About

Go-based K8s sensor simulator with a full observability stack and automated Argo CD GitOps.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages