Skip to content

Instantly share code, notes, and snippets.

@ianhomer
Created June 15, 2025 11:22
Show Gist options
  • Select an option

  • Save ianhomer/5dc7d077dcdc41d75df0a7eae2133e04 to your computer and use it in GitHub Desktop.

Select an option

Save ianhomer/5dc7d077dcdc41d75df0a7eae2133e04 to your computer and use it in GitHub Desktop.
Prune Prometheus Metrics
# Enable prom web Admin API - --web.enable-admin-api
# Tunnel to prometheues API
kubectl port-forward -n monitoring prometheus-prometheus-kube-prometheus-prometheus-0 9999:9090
# List __name__ value
curl -g http://localhost:9999/api/v1/label/__name__/values | jq | less
# Prune by query
curl -X POST http://localhost:9999/api/v1/admin/tsdb/delete_series --data-urlencode 'match[]={__name__=~"apiserver.*"}'
# Clean tombstones
curl -X POST -g http://localhost:9999/api/v1/admin/tsdb/clean_tombstones
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment