pgkube is an open-source Kubernetes workload analyzer that stores and processes data in a PostgreSQL database.
- Collects workload information from a Kubernetes cluster and stores it in a PostgreSQL database.
- Provides a user interface for querying and visualizing the collected data.
- Allows exporting data in CSV format.
curl https://raw.githubusercontent.com/r2k1/pgkube/main/kube/postgres.yaml --output postgres.yaml
# It's highly recommended to modify postgres.yaml and change default PostgreSQL user, and password before applying it
curl https://raw.githubusercontent.com/r2k1/pgkube/main/kube/pgkube.yaml --output pgkube.yaml
# Modify pgkube.yaml to adjust the namespace and PostgreSQL connection string (DATABASE_URL).
kubectl apply -f postgres.yaml
kubectl apply -f pgkube.yaml
pgkube automatically creates the necessary tables in the database. It's recommended to create a separate database or schema specifically for pgkube.
curl https://raw.githubusercontent.com/r2k1/pgkube/main/kube/pgkube.yaml --output pgkube.yaml
# Modify pgkube.yaml to adjust the namespace and PostgreSQL connection string (DATABASE_URL).
kubectl apply -f pgkube.yaml
kubectl port-forward -n pgkube svc/pgkube 8080:80
Open http://localhost:8080 in your browser.
Use your favorite tool (such as PgAdmin, DBeaver, Grafana, PowerBI, Tableau, Apache Superset, JetBrains IDE, Redash, etc.) to query the database and analyze the data. You can also use the built-in UI to generate more advanced queries.
A good starting point is:
SELECT * FROM cost_hourly;