Skip to content

Instantly share code, notes, and snippets.

@moio
Created August 6, 2025 09:05
Show Gist options
  • Select an option

  • Save moio/a1c5b4e827c28c9ed8830ab7b85c32cd to your computer and use it in GitHub Desktop.

Select an option

Save moio/a1c5b4e827c28c9ed8830ab7b85c32cd to your computer and use it in GitHub Desktop.
Running timed SQLite queries directly from a Rancher pod

Running timed SQLite queries directly from a Rancher pod

NOTE THIS IS NOT SECURE FOR A PRODUCTION ENVIRONMENT, use for development/test only.

kubectl exec into the Rancher pod, then:

curl -k -o sqlite-tools.zip https://www.sqlite.org/2025/sqlite-tools-linux-x64-3500400.zip
unzip sqlite-tools.zip

./sqlite3 /var/lib/rancher/informer_object_cache.db

.timer ON

Then run your query, eg.:

SELECT o.object, o.objectnonce, o.dekid FROM "_v1_ConfigMap" o JOIN "_v1_ConfigMap_fields" f ON o.key = f.key ORDER BY f."metadata.name" ASC LIMIT 100 OFFSET 4800;

To explain a query, prefix it with EXPLAIN QUERY PLAN:

EXPLAIN QUERY PLAN SELECT o.object, o.objectnonce, o.dekid FROM "_v1_ConfigMap" o JOIN "_v1_ConfigMap_fields" f ON o.key = f.key ORDER BY f."metadata.name" ASC LIMIT 100 OFFSET 4800;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment